For much of the play Hamlet is terrified of dying, or maybe more accurately terrified of what may happen after death. “No traveler returns” from death, he muses, forgetting in that moment that his father HAS returned, at least possibly, assuming, of course, he’s not a demon in disguise… What happens to your soul, your consciousness, after death consumes him – what if it’s torture? What if it’s nothing? The possibilities trap him and leave him unsure how to proceed.
Something has happened to him by the time he encounters the Gravedigger, though. Having been unable to kill Claudius, he was shipped off to England, ensured the death of two colleagues, and came extremely close to death himself at the hands of pirates. He escaped, barely, and the brush with death has changed him. The skulls don’t repel him (well, they still do a little bit), instead they remind him that everyone will be a skull eventually, and the thought of that leaves him oddly peaceful. Rather than a terrifying plunge into the unknown, he starts to see death as the last stop on a journey, to be embraced and acknowledged as inevitable.
Hamlet has spent the play fighting against death and struggling with his own feelings about it. However, in this graveyard seen, he seems finally to have found some peace. He acknowledges the inevitability of death, and accepts that it is the natural end to everyone's life, rich or poor, important or insignificant; it binds all humans. Unfortunately, at the moment at which he might have given up his vendetta, Hamlet is propelled into action, which then leads to his own death and the death of many around him.