Hostility towards Chinese immigrants in the 1870s was caused by at least two factors.
The first of these was an economic factor. During the 1870s, the US economy was experiencing a downturn. As this happened and people lost their jobs, they came to resent the fact that there were immigrants who still had jobs.
The second factor was racial. White Americans felt that they were superior to the other races in those days. Because of this, they looked down on the Chinese. This caused them to want to keep Chinese out of America.
So, Americans were hostile to the Chinese because they saw Chinese as both racially inferior and as threats to the jobs of white Americans.
Chinese immigrants were greatly looked down upon and tread probably worse than any other immigrants. As you might know Chinese immigrants came to America around this time to seek a better opportunity and many worked on the railroad system. During this the in the late 1800's thousands of Chinese immigrants were coming especially since there were little restrictions placed on immigration. However when they civil war came to end America began to settle in a economic depression since many thought the cause to be Chinese people which caused a great tension to arise. This tension possibly even created the Chinese Exclusion Act which prohibited Chinese immigrants from immigrating to America.