A city built twice
Panama City was founded on 15 August 1519 by the Spanish conquistador Pedro Arias de Ávila — Pedrarias Dávila, as the record usually calls him — on a stretch of Pacific coast that made it the launching point for the conquest of the Inca Empire in Peru and a relay station for the gold and silver Spain shipped home through the isthmus. For a century and a half it did exactly that job: ships in from Peru, mule trains across the land bridge, ships out from the Caribbean side toward Seville.
On 28 January 1671, the Welsh privateer Henry Morgan landed with roughly 1,400 men, sacked the city, and burned most of it to the ground. The original site — now called Panamá Viejo — was never rebuilt. Instead, the Spanish moved five miles down the coast and started over in 1673 on a small, easily defended peninsula, walling the new settlement against the next pirate. That walled peninsula is Casco Viejo, the old quarter every visitor walks through today. The ruins of the first city and the reconstructed second one are both UNESCO World Heritage Sites now, inscribed as a matched pair — one city, told twice.
The trail before the canal
Long before any canal existed, this isthmus was already the fastest way across a continent, and the California Gold Rush proved it. The Panama Railroad Company was chartered in 1848, the same year gold was found at Sutter's Mill, and construction dragged through disease and swamp until the line opened fully in 1855 — the first transcontinental railroad in the Americas, built fifty-four years before its more famous US counterpart. Between 1848 and 1869, roughly 375,000 people crossed the isthmus heading west and 225,000 came back the other way, all of them choosing a jungle railroad over a wagon route across the Rockies or a voyage around Cape Horn. The traffic rebuilt the city's fortunes a full three decades before a single shovel of canal dirt was turned.
The canal that broke France
Ferdinand de Lesseps had just built the Suez Canal, and in 1881 he brought the same sea-level design to Panama, certain that a triumph in the desert would repeat itself in the jungle. It did not. Between 1881 and 1889, disease killed more than 22,000 workers on the French project — malaria and yellow fever, spread by mosquitoes nobody yet understood were the vector, cutting through a workforce drawn from across the Caribbean and Europe alike. By 1884 the death rate topped 200 people a month. De Lesseps kept raising money and recruiting labor long after the targets had become fiction, and when the Compagnie Universelle finally collapsed in 1889, the resulting fraud trial — the Panama affair — ensnared French officials at the highest level and briefly implicated even Gustave Eiffel, who had designed the canal's lock gates.
The Americans finish it
Panama declared independence from Colombia on 3 November 1903, with unmistakable encouragement from Washington, which wanted the canal rights Colombia's senate had just refused to ratify. Weeks later, the new republic's negotiator — a French engineer named Philippe Bunau-Varilla, not even Panamanian — signed the Hay–Bunau-Varilla Treaty granting the United States a permanent, ten-mile-wide canal zone. The engineering that followed succeeded largely because of a decision the French never made: put the doctors in charge first. William Gorgas, the chief sanitary officer, treated mosquito control as engineering, draining swamps and fumigating entire neighborhoods until yellow fever was eradicated from the isthmus by November 1905. With the disease problem solved, the Americans redesigned the canal around a system of locks rather than a sea-level cut, and finished it on 15 August 1914 — by coincidence, the 395th anniversary of the city's own founding.
A long argument over who owns it
The canal's completion didn't end the story so much as start a different one: fifty years of dispute over the ten-mile Canal Zone that ran through the middle of the country, administered as US territory with its own courts, schools, and currency, physically bisecting Panama City itself. Resentment boiled over on 9 January 1964, when a dispute over flying the Panamanian flag inside the Zone erupted into rioting that killed more than twenty people, an event Panama still marks as Martyrs' Day. It boiled over again in December 1989, when the United States invaded to remove General Manuel Noriega, a former US intelligence asset turned drug-trafficking dictator; fighting around his military headquarters burned much of the old wood-framed El Chorrillo neighborhood to the ground. The dispute finally resolved on its own terms: under a 1977 treaty negotiated a decade earlier, the United States handed full control of the canal to Panama at noon on 31 December 1999, and it has run the waterway ever since.
Casco Viejo, rebuilt again
By the 1990s, the walled peninsula built after Henry Morgan's raid had decayed into one of the city's poorest, most dangerous neighborhoods — beautiful colonial bones, largely abandoned. UNESCO listed Casco Viejo as a World Heritage Site in 2003, and the restoration that followed is the Casco Viejo a visitor walks through now: French balconies, Spanish colonial facades, and Antillean-Caribbean shophouses, often on the same block, because the district was rebuilt across three centuries by whoever controlled the isthmus at the time. It's still an active restoration, not a finished museum piece — half-restored buildings sit beside fully renovated ones, and that visible unevenness is closer to the neighborhood's honest state than any postcard version of it.
Before you go: this is a capital city that has been founded once, burned once, rebuilt on a different site, invaded twice by outside powers who each left a canal-shaped reason for staying, and is now mid-restoration for the second time in its history. None of that is background trivia you can skip past on the way to the locks. Miraflores works because Gorgas's mosquito campaign worked first. Casco Viejo's mismatched architecture reads as chaos until you know three empires built pieces of it in different centuries. And the whole reason any of this sits where it does is that a Spanish governor picked this stretch of coast five hundred years ago because it was the shortest line between two oceans — the same fact that has been drawing outside powers back to this isthmus ever since.