The Tower of Babel is described in Genesis 11:1-9. After the Flood, God commanded humanity to "increase in number and fill the earth" (Genesis 9:1). Humanity decided to do the exact opposite, “And they said, Go to, let us build us a city and a tower, whose top may reach unto heaven; and let us make us a name, lest we be scattered abroad upon the face of the whole earth.” Genesis 11:4. Humanity decided to build a great city and all congregate there. They decided to build a gigantic tower as a symbol of their power, to make a name for themselves (Genesis 11:4). This tower is remembered as the Tower of Babel.
In response, God confused the languages of humanity so that they could no longer communicate with each other (Genesis 11:7). The result was that people congregated with other people who spoke the same language, and then went together and settled in other parts of the world (Genesis 11:8-9). God confused the languages at the Tower of Babel to enforce His command for humanity to spread throughout the entire world.
Some believe that God created the different ethnicities of humanity at the Tower of Babel. This is possible, but it is not taught in the biblical text. It seems more likely that the different ethnicities existed prior to the Tower of Babel and that God confused the languages at least partially based on the different ethnicities. From the Tower of Babel, humanity divided based on language (and possibly ethnicity) and settled in various parts of the world.
Genesis 10:5, 20 and 31 describe Noah’s descendants spreading out over the earth “by their clans and languages, in their territories and nations.” How is this possible since God did not confuse the languages until the Tower of Babel in Genesis chapter 11? Genesis 10 lists the descendants of Noah’s three sons: Shem, Ham, and Japheth. It lists their descendants for several generations. With the long life spans of that time (Genesis 11:10-25), the genealogies in Genesis 10 likely cover several hundreds of years. The Tower of Babel account, told in Genesis 11:1-9, is a “flashback” to the point in Genesis 10 when the languages were confused. Genesis 10 tells us of different languages. Genesis 11 tells us how the different languages originated.