All people of every race and culture has a territorial instinct and this situation is another example of it. 

It shows up mostly in western countries because those are the countries most desirable to live in and are under siege by outsiders. People in those countries are labeled as racist or xenophobic but being territorial is a common trait to all humans.

China, for example, doesn't have much of a problem with outsiders because it is such a toxic, corrupt hellhole that most Chinese people want to get the heck out of if they had half a chance...and enough money.