My website is hosted by HostGator, but the domain registration is with GoDaddy. My understanding is that the domain registrar - in this case GoDaddy - hosts a service that converts the domain names they administer into IP addresses, and that this is called a nameserver. So GoDaddy is the authoritative source of the information that maps my domain name into an IP address. When I make a change in GoDaddy, the new information gradually propagates to other name servers across the Internet. When someone visits my website, their computer asks its local name server, which asks another name server, and so on until the request gets back to GoDaddy who has the authoritative answer. (I realise there as such things as root name servers but I'm trying to keep things simple.)
Am I right so far?
So why is it that I have just been told that I need to set the name servers in my GoDaddy configuration to point to two that are hosted by HostGator? I've done it but it just doesn't make sense to me. I would have though that if anything, HostGator would need to be pointed to the GoDaddy nameservers, since it is GoDaddy, not HostGator, who maintain the mapping between my domain and its IP address.
I apologise for the obvious confusion in my question. If someone could enlighten me I would be very appreciative!