At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
comedy started from the greeks. during those times comedy doesnt really mean something funny. comedy are any acts that ends in happy endings. later on, the concept of comedy changed. it became something that ended in a happy ending but also has a lighter tone which means there isnt much drama involved, compared to its predecessor which can include any genre as long as it ends with a happy ending. as time passed comedy became something that provokes laughter and is funny. now, comedy is used as entertainment and laughter
Just to add on what @Igbasallote was saying, the opposite of a comedy was a tragedy, that ended with the main character dying, or something bad happening to that character.
It might be helpful to pay attention to the following: Comic plots proceed from chaos to order; tragic plots proceed from order to chaos. Comedy was described by Aristotle as an imitation of "inferior action." It was meant to present the ridiculous, rather than the noble, and by exposing human actions to ridicule, please and instruct the audience. Old Comedy (as practiced by Aristophanes) dealt with the political and social, while New Comedy (as written by Menander and later, the Romans) engaged with the domestic and particular.