The passage in question here, the last of the series of 'myths' that have been strung together in Genesis 1-11, is perhaps the most misunderstood by general readers for two reasons. The first reason is a simple ignorance of ancient Near Eastern culture. The average reader has only a cursory knowledge of Mesopotamian religious culture, so no one is really to blame for that. The second reason is a baffling translation choice, which in my opinion places the blame squarely on that of the translators.
The story is familiar: after the flood, the people of the earth gather into one city, where they intend to build a tower to escape another flood. God intervenes, and as humanity scatters across the earth the tower remains unfinished.
The myth begins by pointing out that humanity spoke a single language, and concludes with God compelling people to speak in many different languages, to the point they cannot interact with one another.
And Yahweh said, 'Look, they are one people, and they have all one language; and this is only the beginning of what they will do; nothing that they propose to do will now be impossible for them. Come, let us go down, and confuse their language there, so that they will not understand one another’s speech.' So Yahweh scattered them abroad from there over the face of all the earth, and they left off building the city. Therefore it was called Babel, because there Yahweh confused the language of all the earth; and from there the Lord scattered them abroad over the face of all the earth.
Similar to the issue of Genesis 1 and Genesis 2 presenting two irreconcilable versions of how God created the world, scholars have noted that Genesis 11.1-9 is an alternate take on the diversity of nations and languages, in contrast to the version found in Genesis 10. It has been speculated that the story in Genesis 11.1-9 intends to be a reversal of the sentiment in a Sumerian story from the 21st century BC, Enmerkar and the Lord of Aratta. Here, the god Enki is implored to one day unify the many languages of humanity.
On the issue of translation, we all call this episode 'the tower of Babel'. In the original Hebrew text, the author plays on the words Babel and balal: Babel is where human language became balal (confused). Perhaps the choice to translate Babel here is to make a connection to the English word 'babble', which allows the text to keep the Hebrew word-play through an English pun. (Note: there is no etymological connection between Babel and 'babble'.)
The problem is, the Hebrew word Babel shows up all over the bible, but only in Genesis 10 and 11 is it translated into English as 'Babel'. Everywhere else the word is always, consistently, universally translated as 'Babylon'. Genesis 11.1-9 is not telling us about a random mythical city of the ancient past. It is telling us the origin of Babylon. As such, translating the word as 'Babel' instead of 'Babylon' only misleads readers. (In any case, balal is not the etymological root for Babel. The word Babel is Akkadian for 'gate of god'.)
Giving the story as the 'tower' of Babylon, not Babel, leads readers to a very different conclusion. The story is not about a tower made for the purpose of escaping another flood, for the text plainly explains the reason behind the construction process:
Then they said, 'Come, let us build ourselves a city, and a tower with its top in the heavens, and let us make a name for ourselves; otherwise we shall be scattered abroad upon the face of the whole earth.'
We're even told the 'tower' was built out of clay bricks and pitch. For those aware of ancient Mesopotamian religion, this is a clear description of a ziggurat, a temple built for gods to dwell in locally. Ziggurats even had names, such as Etemenniguru, 'Temple Whose Foundation Creates Aura', or Eduranki, 'Temple Binding Heaven and Earth'. These perfectly match the stated purpose of the 'tower' in Genesis 11.
The episode is completely unrelated to the flood. Instead, it is likely an etiology, intending to explain the existence of a ziggurat the Judean exiles saw in Babylon, Etemenanki, 'Temple of the Foundation of Heaven and Earth'. This ziggurat was built centuries before the Babylonian exile, but was destroyed in 689 BC. A century later, at the time of the Babylonian exile, the ziggurat was under reconstruction. The end result was a massive three hundred feet tall, with its temple on the top.
In the Genesis story, the Babylonians are prevented from finishing their ziggurat. God's royal court inspects the construction, and he decides to intervene. Much later interpretations, such as those found in Josephus or Pseudo-Philo (late first century AD) express the now-traditional claim that the 'tower' was built to escape the flood, and even the specific detail that it was Nimrod of Genesis 10.8-12 who commanded the tower's construction. (Other Jewish interpreters say Nimrod was against the tower's construction.) Philo, and the apocryphal 3 Baruch, claim the tower was built so Babylon's people could wage war on heaven.