To simplify your question, there are a couple things to keep in mind.
DNS = Domain Name System
Name Servers = Stores DNS records to resolve domains
On your local computer, you have a DNS resolver that connects you to the global DNS network. Most recently and commonly, you can use Google's public DNS servers at:
220.127.116.11 and 18.104.22.168
When your computer needs to resolve a hostname like google.com, it will first send a generic request to your locally set DNS resolver. That would look like this in a Windows command prompt:
You get a Non-authoriatative answer back, because the name server we just queried doesn't maintain the records for Google, it simply has them cached for us.
You can use the set q=NS command after starting nslookup to query a domain name's authorative name servers:
Default Server: google-public-dns-a.google.com
> set q=NS
google.com nameserver = ns2.google.com
google.com nameserver = ns4.google.com
google.com nameserver = ns3.google.com
google.com nameserver = ns1.google.com
Now your computer can also directly query one of the authoritative name servers, to get back an authoritative response:
C:\Users\JacobN>nslookup google.com ns1.google.com
Now if Google was to update their DNS records on their ns1.google.com name server, it could take between 1-8 hours typically for those records to propagate over to other caching name servers.
So to answer your question, your local DNS server knows how to resolve your domain name, because when you registered your domain name you had to point the name server records to a valid DNS server, making that DNS server (name server) the authoritative server for your domain's DNS queries.
All other name servers on the net, such as Google's 22.214.171.124 will cache your server's response as people search for your domain name. A good example is that your local ISP could be caching DNS queries. For instance if your next door neighbor just got the authoritative DNS records returned for your domain, and then you looked them up right after, more than likely you'll get a cached response from your ISP's name servers rather than the request having to possibly break out of the network just to receive back the same results a minute later.
If no one in asks for your domain name over a 24 hour period, it could be possible for the DNS records to decay and fall out of cache based on their TTL (Time to Live) setting. If this was the case, when someone went to query your domain again, the first thing that would happen would be a whois lookup on your domain seeing what the authoritative name servers are for the domain, and then you'd be getting an IP address resolved back from your local DNS server that you've setup to handle those requests.
Name servers and DNS are a pretty complex topic, if you need any further explanations let me know, as I've written extensively about them: