Um... Not sure I'll bother with spoilers for this one.
Basically a 'comedy' is a piece of writing with a 'happy' ending (often involving redemption etc), used for plays by the Greeks and Romans, but later applying to verse in the middle ages.
In the Divine comedy Dante is lead through hell in cantica I: Inferno, Purgatory in II: Purgatorio and heaven in III: Paradiso. In Paradiso he meets Beatrice (based on a tragic love he had as a young man), sees heaven and is allowed to return to Earth to talk of his experiences.
Happy ending, so comedy.