Long before it became an archaic, filthy, profligate symbol of everything wrong with our broken cities, New York’s subway was a marvel — a mad feat of engineering and an audacious gamble on a preposterously ambitious vision. “The effect it is to have on the city of New York is something larger than any mind can realize,” said William Gaynor, the New York mayor who set in motion the primary phase of its construction. A public-works project of this scale had never before been undertaken in the United States, and even now, more than a century later, it is hard to fully appreciate what it did for the city and, really, the nation.

Before the subway, it was by no means a foregone conclusion that New York would become the greatest city on earth. Hundreds of thousands of immigrants fleeing poverty and persecution were arriving on its doorstep every year, but most of them were effectively marooned, herded into dark, squalid tenements in disease-ridden slums. The five boroughs had recently been joined as one city, but the farms and villages of Brooklyn, the Bronx and Queens might as well have been on the other side of the planet from Manhattan’s teeming streets. Bound up in the fate of the city were even larger questions: Would America be able to manage the transition from the individualism and insularity that defined its 19th-century frontiers to the creative collaboration and competition of its fast-growing urban centers? Could it adapt and excel in this rapidly changing world? Were cities the past or the future of civilization? And then came the subway: hundreds of miles of track shooting out in every direction, carrying millions of immigrants out of the ghettos and into newly built homes, tying together the modern city and enabling it to become a place where anything was possible.