They lived next to water for the convenience of having fresh water for crops, drinking water, and whatever else they use water for.
It also provided as a safe-defense from enemies, because it's harder to ambush a civilization when you have to travel through water.