When France ceded the lands of the Illinois Country (east of the Mississippi) to Great Britain in the 1700s, all the French had to GTFO. St Louis was the highest land along the Mississippi anywhere close to the confluences of the Missouri, Ohio and Illinois rivers. Since the Mississippi flooded almost every spring, this was the best place to put a city and it allowed the French to maintain more control over the area than they were supposed to have.
The railroads were built by men, however, and could have gone anywhere. The negotiations and influencing that got them all built through Chicago has had a huge ROI for the last 150+ years.
That explains it. I kept thinking there must be better spots to put it. It does appear though that it’s surrounded by wide flood plains on several sides and certain spots would be harder to ford than the narrows that bracket the city on two sides.
https://www.chicagotribune.com/news/ct-xpm-2007-09-27-070926...
It's about as centrally located to the US as you can get from the Great Lakes, and once a canal opened (in this case, the Eerie, but shorter canals could have existed, it was just in NYC's interests to have that particular canal), then that's about as far as a boat can go, and water traffic is more efficient than rail.
So you would have trains leaving 'Chicago' to go everywhere, and someone would have thought to build a canal to get to the Illinois river and hence the Mississippi.
I'm not so sure that "St Louis" had to be exactly where it is, but Chicago is virtually a foregone geographical conclusion.