Hamlet's tragic external circumstances, to include the adultery of his mother, treachery of his uncle, grief at his father's murder, and the meddling of Palonius as well are all catalysts for the internal conflicts within Hamlet that lead to his bitterness. The greatest of these is the struggle between doing what he knows is wrong, (Killing Claudius) thereby damning his own soul and revenging his father, which he feels duty-bound to do.
In addition to all of the incidents listed above, there is an intrinsic melancholia in Hamlet as he contemplates suicide in Act I Sc. ii: "O, that this too too salied flesh would melt...into a dew..."
Further evidence of melancholia is in his meditations upon man in general: "What a piece of work is man...yet to me, what is this quintessence of dust?..." Later, Hamlet remarks, "There is a doomsday near....A dream itself is a shadow....I have lost all my mirth, forgone exercises...." (Act II, Scene II).
And, in his bitterness there may also be some misogyny in his attitudes toward Ophelia, and especially his mother: "Fraility thy name is woman (Act I, Sc. ii), and "O most pernicious woman/O villain, villain, similing damned villain.... "(Act I, Scene v)
See the second source listed below.
Eaglecat writes that Hamlet knows killing Claudius is wrong. I disagree. In the context of the play revenging his father is the right and honorable thing to do. Hamlet delays this revenge on several occasions waiting for proof that the ghost is telling the truth. This he gets when Claudius shows his guilt at the performance of the play.
Hamlet's bitterness has mostly to do with his isolation. He's an only child who's lost his father--the only other person who could understand the way he feels is his mother who's escaped from dealing with her loss in the oblivion of her new relationship with Claudius. Hamlet is thus distanced from his mother, his friends R & G are turned against him. Obviously his uncle is now seen in a bad light. He sees Polonius as a superficial "prating" man of "words, words, words." And because he sees his mother as fickle he can no longer trust his girlfriend. His confidant Horatio is not that close--he's of a lower social class and a not a "native" of Denmark. Add in that he's probably been sheltered from a lot of hard knocks, as the son of the king, he's forced to grow up rather quickly and under the worst possible circumstances. His bitterness is an expression of his immaturity at the start of the play. He grows throught the course of the 4 hours to accept responsibility and even ("readyness is all") the inevitability of death.
multiple things: the murder of his father, the fact that his mother married Claudio so quickly, the fact that he is being lied to - His mother and Claudio make sneaky attempts to figure out what's bothering him - including getting his friends Rosencrantz & Guildenstern to try and find out what's bothering him, Polonius is always lurking around trying to find things out, (they even get his girlfriend to play a role in the plot) and of course, eventually, Claudio tries to arrange to have him killed. Overall, it has to do with a lack of trust all around him.