With the advent of locomotives in the 19th century, cities worldwide began building majestic stations to welcome global travelers—and to impress them.