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:
8.8.8.8 and 8.8.4.4
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:
C:\Users\JacobN>nslookup google.com
Server: google-public-dns-a.google.com
Address: 8.8.8.8
Non-authoritative answer:
Name: google.com
Addresses: 2607:f8b0:4004:802::1008
74.125.228.71
74.125.228.66
74.125.228.72
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:
C:\Users\JacobN>nslookup
Default Server: google-public-dns-a.google.com
Address: 8.8.8.8
> set q=NS
> google.com
Server: google-public-dns-a.google.com
Address: 8.8.8.8
Non-authoritative answer:
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
Server: ns1.google.com
Address: 216.239.32.10
Name: google.com
Addresses: 2607:f8b0:4004:806::1008
74.125.228.194
74.125.228.193
74.125.228.201
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 8.8.8.8 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:
http://www.inmotionhosting.com/support/domain-names/dns-nameserver-changes/what-is-a-name-server