After the flood, there were just a few people left, they all knew the same language, the same words. They started to build a tower that would reach the sky, but they were just building it just to make themselves known or make themselves look good. When God saw that this was happening he decided to make them stop by changing their language so they couldn’t understand each other. After that, the people couldn’t understand each other and they started to have trouble finishing the tower. People then started to leave the place and go around the world, and that was how the world was divided.
"The whole world had the same language and the same words... 'Come, let us build ourselves a city and a tower with its top in the sky, and so make a name for ourselves; otherwise we shall be scatted all over the earth.'" (Gn 11:1-4)
"Then the Lord said: If now, while they are one people and all have the same language, they started to do this, nothing they presume to do will be out of their reach." (Gn 11:6)
"So the Lord scattered them from there over all the earth, and they stopped building the city. That was why it was called Babel, because there the Lord confused the speech of all the world. From there the Lord scattered them over all the earth." (Gn 11:8-9)
You should never do something without reason. There always have to be a reason to do something but that reason can't be just because you want to or because it makes you look cool, it has to be because of something not selfish.