“Gotham” has been a nickname for New York City since the 1807 publication of the Salmagundi Papers by Washington Irving and James Kirke Paulding. On December 13, 1940, one comic book used a setting of “Gotham City.” In February 1941, Detective Comics used “Gotham City” for a new comic book character called “Batman.” Gotham City was a dark, crime-ridden place.
In 2008, city councilman Hiram Monserrate proposed making “Gotham City” (not “Gotham") the official nickname of New York City, ahead of “the Big Apple” and all other nicknames. This was to coincide with the movie Batman: The Dark Night—that was shot in Chicago. “Gotham City” is trademarked by DC Comics, so New York City would not have the promotional rights to this nickname.
Gotham City is a fictional city appearing in DC Comics, and is best known as the home of Batman. Batman's place of residence was first identified as Gotham City in Batman #4 (Winter 1940).
Gotham City is based on many large cities such as Baltimore, Chicago and (more widely seen as) New York City, in fact, "Gotham" has been used in recent times as a moniker for New York.
https://en.wikipedia.org/wiki/Gotham_City