Metropolis became Superman's hometown in Action Comics. Superman's first base of operations was Cleveland, Ohio, before moving to a new city. It was first set in Canada, and only later in the US. In-universe, Metropolis was at first a nickname before becoming the official name.
Metropolis has, like Gotham City, always been meant to evoke the spirit of New York. But while Gotham City represented the darkness, Metropolis was the Big Apple during the Day. In the comics, Metropolis is placed in Delaware.
The DCAU's Metropolis' location is uncertain. It's shown to be on the west coast in various wide shots ("The Prometheon", "Little Girl Lost", "The Return"), but the layout of the city and the surrounding land is not portrayed in a consistent manner.
In "Speed Demons", the Mardon house is said to be near Metropolis, but it's not stated how near—the map shows the house in southern Pennsylvania, near Harrisburg. Seeing as how Metropolis is on the coast, it could be in New Jersey, Maryland, Delaware or even New York. In "The Late Mr. Kent", Metropolis is shown to have capital punishment by gas chamber, limiting it to Maryland—though this can be ascribed to a California-based writer, where the gas chamber was a main means of execution at the time.