Here's why:
* Polonius: While he's not meant to be a comedic character in the traditional sense, his pompous, overly-serious, and often foolish nature makes him a source of amusement for the audience. His tendency to misunderstand situations and misinterpret events provides a sense of absurdity. His meddling and constant attempts to control his children, especially Ophelia, often backfire hilariously.
* Gravedigger: This character, while not central to the plot, is a master of witty banter and cynical observations. His humorous conversations with Hamlet about life, death, and mortality provide a light-hearted counterpoint to the play's darker themes. His nonchalant attitude toward death and his philosophical musings on the meaninglessness of life offer a moment of comic relief in the face of tragedy.
While Hamlet itself is a dark and tragic play, these characters inject a dose of humor that adds to the play's complexity and provides a much-needed break from the intense drama.