They didn’t. People experienced local storms and floods and developed stories to explain them.
Except that thats not true. Nearly every ancient culture has the same story of a global deluge with some variation of the details.
Ants walking across an inflated balloon believe it is a solid object because they are too small to effect the surface and they have very small minds.
Humans believe the earth is a solid object also because they are too small to effect the surface and have very small minds.
If you took two small frying pans and froze ice rounds in them and then put a water balloon between the two like a water balloon sandwich, would that effect the shape of the water balloon?
Genesis and the Tower of Babel also explain why we see ziggurats or pyramid structures around the world.