Canals were really the technology of the 18th century. In 1827 the Baltimore and Ohio was opened as the first passenger and freight railroad and railroads started popping up extrenely rapidly, initially chartered by basically every city to be built along existing roads, then later built with their own right of way.
West of Appalachia, the land is relatively flat and the existing permanent native American settlements were sparse since their population had collapsed from disease brought by colonists centuries earlier. Railroads engaged in real estate speculation platting out and selling land in cities every 10-20 miles (because the early steam locomotives needed water every 10-20 miles, so might as well have them take on passengers/freight too!) and the federal government was practically paying railroads to take land to better establish the United States' claim to the land. This rail building boom peaked around the 1860s around which point consolidation started reducing the quantity of rails as railroads consolidated and began building more focused trunks out of their existing right of way.
In fact, because of how the land grants were written most railroads built a single track in a straight line as fast as possible between their start and end, then once they'd secured the grant for connecting the two points by the extremely aggressive deadline, only then would they start actually rebuilding the track so that it would actually be usable for real rail service.
So in short, it was a combination of lack of existing (white) cities, land grants by a new government trying to secure its land claims that it believed were it's manifest destiny, plus innovations in steam engines to make steam locomotives truly viable right at the time when the flegling nation had its feet under it and was ready to start investing heavily into itself.
TL;DR Right place, right time, right legal environment and right technology