You're not specifying any time, so I'm going to make an assumption, which is that you're talking about pre-Industrial times.
In that case, the question implicitly assumes that the modern nation-state was how things always worked. However, the whole "I belong to [nationality]"-narrative is a byproduct of the industrial revolution.
Before the industrial revolution things worked very differently: people moved around more freely, and tended to say they were from a region, city, culture, instead of belonging to a country. Countries were more the domain of rulers, who cared about where they could impose taxes. The invention of the modern nation state changed that.
So basically: because back then, people could just migrate more freely.
Sources:
"End of nations: Is there an alternative to countries?" by Debora MacKenzie - aNewScientist article discussing how the nation state came to be
"A Commonwealth Of Diverse Culture - Poland's Heritage" - a website dedicated to the pre-WWII diversity of the Polish-Lithuanian commonwealth. I really encourage you to have a look here, it will probably give you a good impression of how things worked back then.