I think the main reason is that the population of China is too big. Though China has very big territory, many areas of the northwestern parts are not suitable for human habitation. So the government is always trying to control the rapid population growth. The government even made the wrong decision——family planning to prevent the population growth. I know people from developed areas like Europe and US won’t immigrate to China a lot even if becoming a citizen of China is not hard. While the mass migration from the Mid East and Africa will be a big problem if the “door” is open. I’m not racist and I don’t reject the immigrants, but I hope foreigners see our difficulties: people are too many in China and the resources are too limited to support so many people. Thus if you want a better life, don’t rely on immigrating to other countries coz we can help you develop your country as what we do help to some African countries. I admit that these helps are for benifits in some degree, but those countries benifit too.
Personally I don’t think it has so much about to do with the population size. In fact, the demographic problem with China is actually the opposite, i.e. too low birth rates.
Instead, I believe it’s the fact that China throughout history has been invaded from all directions, e.g. Mongols, French, British, Japanese, hence too many foreigners is perceived as a threat to social stability (apart from those who are extremely knowledgeable that can significantly contribute to society), and this notion is well cultivated in school and in history books.