In simple terms, the main difference between comedy and tragedy is that the comedy is a humorous story with a happy ending while a tragedy is a serious story with a sad ending.
Answer:
In rough terms, a comedy follows a storyline where the hero, flawed as he or she may be, seems to be heading for disaster though, through felicitous or fortuitous and comic circumstances, avoids disaster; whereas in a tragedy, the hero encounters forces of fate or circumstance that are stronger than he or she is and which, in the end, bring the hero to a more or less catastrophic end.