The Gemara in Sanhedrin says that there were three groups involved with the Tower of Babel. The first group said, נעלה ונשב שם, that we will go up to heaven and dwell there. This group was simply scattered.
The second group said, נעלה ונעשה מלחמה, that we will go up and make war with Hashem. This group were turned into monkeys as their punishment.
And the third group said, נעלה ונעבוד עבודה זרה, that we will go up and worship idols. It was this group that became confused and suddenly spoke different languages.
This was the Gemara’s Midrashic understanding of the motivations in building the מגדל בבל.