Dante's Divine Comedy often seems misnamed to modern readers, since there is nothing particularly funny about it. There are really two elements which make it a comedy according to the definition of the Middle Ages. In the first place, it has a happy ending, concluding a narrative in which there is no serious disruption of order. In this sense, "comedy" is something of a catch-all definition for a work that is clearly not a tragedy.
The second element is linguistic. Dante was revolutionary in using the vernacular, the common language of his time, to write about Heaven, Hell and matters of cosmic significance. Comedy has always used a more down-to-earth vocabulary than tragedy and, once again, the two are clearly opposed, so that Dante's work becomes one by clearly not being the other.
It is important to make the distinction between the Divine Comedy as a whole and the Inferno, which is only the first third of the poem, though it is the most celebrated and frequently-read part. Even the Inferno on its own could not be a tragedy, since there is nothing tragic about just punishment, and God is controlling everything that happens. However, it would be more difficult to justify calling the Inferno alone a comedy, since it lacks the happy ending provided by the Paradiso.