New York City. The nickname was popularized by Washington Irving and others in Salmagundi, a series of satirical sketches (1807-1808).
The term "gotham" is actually taken from "Gotham Tales", which are a cycle of stories about feign madness. They first became associated with the village of Gotham (pron. ‘goat ham’) in Nottinghamshire around 1540. Therefore, Gotham became associated with "a city of fools".