Large-scale Chinese immigration began in the mid 1800's due to the California Gold Rush.
The first Chinese immigrants were well and widely received by the Americans. However, the first Chinese immigrants were wealthy, successful merchants, along with skilled artisans, fishermen, and hotel and restaurant owners. For the first few years they were greatly receipted by the public, government officials, and especially by employers, for they were renowned for their hard work and dependability.
Americans' attitudes then changed.
The Naturalization Act of 1870 restricted all immigration into the U.S. to only "white persons and persons of African descent," meaning that all Chinese were placed in a different category, a category that placed them as ineligible for citizenship from that time till 1943, says Thinkquest.org.
This law was the first significant bar on free immigration in American history, making the Chinese the only culture to be prohibited to freely migrate to the United States for a time. Even before the act of 1870, Congress had passed a law forbidding American vessels to transport Chinese immigrants to the U.S. The reason behind the Chinese Exclusion Act of 1882 was to prevent an excess of cheap labor.