The earliest modern humans (Homo sapiens) were thought to have lived along the coast and taken advantage of coastal food resources such as shellfish, crustaceans and fish. Human radiation out of Africa seems to have often taken a coastal route. The initial migration into the Americas seemed to have also taken a coastal trajectory.
So the earliest human settlements were probably sea-side communities. The earlier answer on trade, transport, communication and the key element of fresh water sources as essential for coastal waters is excellent, I just thought to provide some time depth.
Seaside communities developed because prehistoric humans recognized the advantages of living close to water. Living close to the ocean was good, and living close to the outlet of a river into the ocean was quickly recognized as being even better. That's why ancient cities were so often built at naturally occurring ports.
Water was essential for drinking purposes - even if the water in the ocean was not good to drink, the water from a river flowing into the ocean could be used.
That river water also provided a source of food in the form of fish and in the form of animals that came to the river to drink. When agriculture began, the farmers learned to water their crops, first by carrying water to the plants and later through irrigation ditches.
Water also provided an easier method of transportation than carrying goods over land. As trade developed with groups living in other locations, boats were designed and built to enable people to get from place to place.