It is true that nativism has long been a strain in American culture, despite the idea that the United States is a haven for the world's refugees. There are several reasons for the emergence and resurgence of nativism over time.
Nativism tends to rear its ugly head during times of cultural and economic insecurity. During the early 1800s, immigrants arriving from Ireland and Germany threatened America's conception of itself as a Protestant nation. In addition, new immigrants brought with them different forms of religious and cultural practices, such as the use of alcohol in religious ceremonies. These ideas were threatening to people. Immigrants tended to work hard and occupy jobs, such as factory jobs and work as domestics, and many of the existing poor feared for their own jobs at these times. American culture has always been changed by immigrants as much as immigrants are changed by it, and this tension and the process of creating a new American culture can be threatening and increase nativism.
We are currently experiencing a period of nativism in which there is a current of anti-immigrant sentiment among some, but certainly not all, Americans. The similarity with earlier periods is that we are in an era of economic uncertainty when many jobs are being replaced by new forms of technology. This uncertainty is what has often given rise to nativism.