It came into being mostly because the city of Baltimore wanted to compete with the newly constructed Erie Canal (which served New York City) and another canal being proposed by Pennsylvania, which would have connected Philadelphia and Pittsburgh. At first this railroad was located entirely in the state of Maryland, with an original line built from the port of Baltimore west to Sandy Hook.
As part of a series of mergers, the B&O is now part of the CSX Transportation (CSX) network, and includes the oldest operational railroad bridge in the USA. The B&O also included the Leiper Railroad, the first permanent horse-drawn railroad in the U.S. At the end of 1970, the B&O operated 5,552 miles of road and 10,449 miles of track, not including the Staten Island Rapid Transit (SIRT) or the Reading and its subsidiaries. It includes the oldest operational railroad bridge in the USA.
The fast-growing port city of Baltimore, Maryland faced economic stagnation unless it opened routes to the western states, as New York had done with the Erie Canal in 1820. On February 12, 1827, twenty-five merchants and bankers studied the best means of restoring "that portion of the Western trade which has recently been diverted from it by the introduction of steam navigation." Their answer was to build a railroad—one of the first commercial lines in the world.
Their plans worked well, as the railroad grew from a capital base of $3 million in 1827 to a large enterprise generating $2.7 million of annual profit on its 380 miles (610 km) of track in 1854, with 19 million passenger miles. The railroad fed tens of millions of dollars of shipments to and from Baltimore and its growing hinterland to the west, thus making the city the commercial and financial capital of the region south of Philadelphia.
According to wikipedia