The Answer
Gotham city is located in New Jersey. Metropolis is in Delaware. However, both are based on New York City.
At the start, both Batman and Superman fought in New York City. Since then, there has been some conflicting information regarding the location, but most references point to Gotham being in New Jersey and Metropolis being in Delaware.
However, different comics and adaptations are pretty inconsistent with the distance between the two cities. In some adaptations they are directly across Delaware bay from each other. Others showed them to be much farther apart.
Even though Gotham City and Metropolis are quite different, NYC heavily inspired them both. Some of the writers have said “Metropolis is New York in the daytime; Gotham City is New York at night.” In fact, both Gotham and Metropolis are two of the many lesser-known names for New York City.
But Bill Finger, one of the creators of Batman, admits to picking the name Gotham out of a phone book, wanting a name that nobody anywhere could identify with.
“Originally I was going to call Gotham City ‘Civic City.’ Then I tried ‘Capital City,’ then ‘Coast City.’ Then I flipped through the New York City phone book and spotted the name ‘Gotham Jewelers’ and said, ‘That’s it,’ Gotham City. We didn’t call it New York because we wanted anybody in any city to identify with it.”
-Bill Finger, creator of Batman
The creators have admitted to drawing inspiration from other real-life cities as well. Chicago has also been referenced as an inspiration for Gotham City, with the many dark alleys that Batman hides in. And the original Metropolis skyline was based off the skyline of Toronto.