At the palace graveyard, two hi-la-rious gravediggers discuss Ophelia's death. (They kinda-sorta refer to the famous 1554 suicide case of Sir James Hales, a dead-by-suicide judge whose land was forfeited to the crown, as was standard punishment for suicides. Mrs. Hales, Sir James's wife, argued that the court could only punish someone for acts committed in their lifetime. "Successful" suicide required the ending of one's life —thus when her husband succeeded at suicide, he was no longer living and couldn't be held accountable, meaning… she should be entitled to his stuff. Hence all the quibbling on whether Ophelia meant to kill herself or not.)
These two men think Ophelia's death was clearly a suicide. Because suicide is an offense against God, those who committed the act were usually not allowed to be buried in a Christian graveyard. Lucky for Ophelia, her family is rich and powerful.
The two keep up the wisecracks as Hamlet and Horatio approach.
Hamlet wonders if these gravediggers are particularly callous, but Horatio points out that doing a task over and over makes it easier—easy enough to crack jokes.
Hamlet philosophizes about how the gravedigger has thrown up two skulls from the hole in the ground. Hamlet wonders who these skulls used to be when they were men.
We (and all our stuff) end up at exactly the same at the end —nothing.
The gravedigger is a chatty guy, and Hamlet makes conversation about how long the man has been lying about in other people's graves.
The gravedigger says he's been at it since the day the old King Hamlet beat Fortinbras, which, coincidentally is the day the young Hamlet was born.
The gravedigger doesn't know who he's talking to, so he tells his new BFF a little more—like that Prince Hamlet has gone mad and been sent England, where it doesn't matter if he's cured since everyone there is mad, too.
Finally, Hamlet gives up on his strange line of questioning and takes up a skull handed to him by the gravedigger. It belong to Yorick, the former King's jester.
The is the famous "Alas, poor Yorick" bit: Hamlet reminisces about the times Yorick used to cart him around on his back and generally makes a melodramatic scene about all the jokes and laughs and dances Yorick used to do, but now can't, being dead and all.
Is this everyone's fate? Hamlet is particularly interested in Alexander the Great, wondering if you could trace his dust until you found him stopping up a "bunghole" (which was literally the hole in a barrel or cask of drink, but, you guessed it, has been slang for "anus" since the thirteenth century.)
Finally, Hamlet's interrupted by the King, Queen, and entourage (including Laertes) following Ophelia to the grave.
He and Hamlet hide out to watch them.
The priest snarks a little about how Ophelia's powerful family got her a nice burial, even though she should really be put at a crossroads for people to throw rocks at.
Laertes doesn't take kindly to all this trash talking of his recently dead sister, and says that Ophelia will be an angel while the priest howls in Hell.
Also, he's not feeling to fondly toward Hamlet right now.
Just then, Hamlet jumps out to announce, "This is I, Hamlet the Dane."
Pretty significant, since that was how you announced the king.
Hamlet promptly leaps into Ophelia's grave and scuffles with Laertes. The two are broken up, and Hamlet declares he'll fight Laertes "on this theme," meaning, the question of who loved Ophelia more, until the end of his days.
Then, he challenges Laertes to a duel, declares that every dog will have its day, and stalks out. It's all very dramatic.
The scene ends with Claudius telling Laertes to be firm about their little plot.