Look at a map of Japan and you will notice that many cities line the coast. In some places, the mountains rise almost immediately behind the city, while the sea lies on the other side. In Japan, that kind of landscape is not especially unusual.
The biggest reason is geography. Japan is a mountainous country, and there is only so much flat land where large numbers of people can live, roads and railways can be built, and cities can expand. In areas where the mountains come close to the sea, the narrow strip of land between them, along with the lower reaches of rivers, naturally becomes the easiest place to build. Once homes, shops, roads, and railways gather there, the city tends to stretch along the coast.
But it would be too simple to say that Japanese cities developed along the sea only because there was no room elsewhere. The coast was also an important route for moving people and goods. Ports and coastal settlements became centers of trade, and once people and industries gathered there, later roads and railways often reinforced those same places.
History also mattered. Some towns grew because they became castle towns, political centers, military strongholds, or important transportation hubs. Rulers invested in certain places, and those places attracted more people, commerce, and infrastructure. That helps explain why two coastal towns with similar geography could develop very differently.
So geography created the basic conditions, but it did not decide everything. Limited flat land, maritime transport, overland routes, political power, and historical importance all worked together to shape where cities grew and how large they became.
To many Japanese people, a city squeezed between mountains and the sea does not feel like an unusual urban form. There is usable land between the two, and people have been building, traveling, and trading there for generations. The geography gave people limited places to build, and history shaped what those places eventually became.
