New York City's five boroughs—Manhattan, Brooklyn, Queens, The Bronx, and Staten Island—are the result of a massive 1898 consolidation that merged independent cities, towns, and counties into a single metropolis.
Before 1898, "New York City" was essentially just Manhattan. The surrounding areas were separate entities: the cities of Brooklyn and Long Island City, the towns of Queens County, and Richmond County (Staten Island). Westchester County voted against joining and remains separate.
The "City of Greater New York" was created by state legislature, effective January 1, 1898, uniting:
Waterways defined the boundaries: the Hudson and East Rivers flank Manhattan; the East River separates Brooklyn/Queens; the Harlem River divides Manhattan from The Bronx; the Narrows and Upper New York Bay isolate Staten Island. These natural barriers shaped distinct identities long before political union.