Dante was born in Florence, Italy, in 1265. He was a well-educated man and was involved in politics. In 1302, he was exiled from Florence for political reasons. He spent the rest of his life in various cities, including Verona and Ravenna.
It was during his exile that Dante wrote The Divine Comedy. The poem is divided into three parts: The Inferno (Hell), The Purgatorio (Purgatory), and The Paradiso (Paradise). In the poem, Dante travels through these three realms, guided by the Roman poet Virgil and the theologian Beatrice.
The Divine Comedy is a work of great beauty and complexity. It is a rich source of symbolism and allegory, and it has been interpreted by scholars for centuries. The poem is also a reflection of Dante's own life and experiences, and it offers insights into the human condition.
Dante died in Ravenna in 1321. He is considered one of the greatest poets of all time, and his work continues to be read and studied by people all over the world.
So, to answer your question, it was his exile from Florence that led Dante to write The Divine Comedy.