Because the site can see your IP address when you connect to it. And your IP tells Netflix exactly what it needs to know: what country and city you are from.
Netflix might also track your location through the tracking cookies it places on your devices when you log into your account or use the site.