Hamlet is one of the best plays that Shakespeare has written. It may be called a master piece of artistic creation.
In each of the plays (the four tragedies) the hero is transformed into something he had not been at the beginning of the play. So in Hamlet's character, there is something which wasn't there before. There is a visibly positive change in Hamlet when he dies. Some of the reasons that Hamlet seems to be a better are that he has accepts his fate towards the end, doesn't delay any longer and admits that he had loved all the people around him.
In the beginning Hamlet is characterized as a meek person who loses all his hopes. Before knowing about his father's death he doesn't want to live anymore. And he even thinks about suicide and death as he says:
O that this too too sullied flesh would melt,
Thaw and resolve itself into a dew,
Or that the Everlasting had not fix'd
His canon 'gainst self-slaughter.
O God! O God!
How weary, stale, flat, and profitable
Seem to me all the uses of this world.
But towards the end Hamlet realizes that everything is subservient to fate and that nobody can do anything if that thing isn't in his or her fate. Like he says:
There is special providence
In the fall of a sparrow. If it be now 'tis not to
Come: if it be not to come, it will be now: if it be not
Now, yet it will come.
This is the final confirmation of the positive change in Hamlet. Now he realizes that death itself will come at an appointed time and not before. At this point Hamlet has taken a spiritual and moral turn, he understands that man is limited in his knowledge...