There were a number of things that caused the United States to impose quotas on immigrants in the 1920s and, to some degree, in the 1930s.
First, we can say that racism had an impact. Asians were practically prohibited from immigrating to the US in the time before WWII. Southern and Eastern Europeans, who were often seen at that time as something less than “white” had their numbers drastically reduced. We can particularly blame racism if we construe anti-Semitism as a form of racism as many of the Eastern Europeans who came to the US before the quotas were Jews.
Second, we can say that the Bolshevik Revolution helped to bring about the quotas. In 1917, the communists took over what had been Russia. This meant that communism came to be seen as a possible threat to the United States. Many of the immigrants who had been coming to the US had radical political views and Americans wanted to keep them out.
Finally, we can say that events within the US had an impact as well. The Boston Police Strike and the Seattle General Strike happened in 1919. These, along with the bombing campaign that led to the Palmer Raids, made it seem that communism might be taking hold in the US.
Anti-immigrant sentiment was growing in the US due to these factors and to the general unease among many Americans about the ways in which the country was changing. These factors led to the immigration quotas such as those imposed in 1924.