I think there may be a couple of reasons for this. One is that this is Dante's allegory of life, and as he is writing the story of a man who has strayed from the straight and narrow path to God, he has to be shown the consequences of his actions. So he is being shown hell first so that he can really see how bad things are if you don't follow the right path. After that he is shown purgatory, and then finally, paradise.
Another reason could have to do with the Roman Catholic theology of purgatory, the state of limbo between heaven and hell. Just because someone had been baptized, went to church every week, etc., etc., did not mean they automatically went to heaven, according to this theology. They first would spend time in purgatory until people still alive had said enough prayers and had enough masses said for the souls of these departed people stuck in limbo (see the link below for more information on this). So because of this purification that the soul must go through before going to heaven, it would make sense for Dante to have to experience hell first (for the lessons he could learn there), then purgatory (because many souls need to spend time there first to be purified), and then finally reach heaven.
Please check the links below for more information! Good luck!