Simple. The Native Americans were disliked. Americans took their land, hunted their buffalo, and forced them off their own land and set them to the Great Plains. The Natives were forced to abandon their culture and instead americans put in their culture. All the Natives wanted was peace. Americans passed the indian Removal Act.
Besides connecting the eastern united states with the western united states, the transcontinental railroad was also instrumental in bringing in immigrants from ireland and china.