There’s a short and easy answer to the question of why Hamlet killed Polonius. It was an accident. A case of mistaken identify, if you will. What he did next, however, certainly was no accident.
The story so far: Hamlet has sprung his mouse trap, playing out Claudius’ crime in front of him with the help of the actors. Claudius reaction has, as Hamlet anticipated, “caught the conscience of the king.” Gertrude, upset with her son for angering her husband, has requested Hamlet come to her bedchamber so she might speak with him. Polonius offers to spy on Hamlet by reaching the queen first and hiding in the arras (curtains).
Hamlet, in exultation at having proven Claudius’ guilt, comes to his mother’s bedchamber and intends to tell her off:
Hamlet. Now, mother, what’s the matter?
Gertrude. Hamlet, thou hast thy father much offended.
Hamlet. Mother, you have my father much offended.
Gertrude. Come, come, you answer with an idle tongue.
Hamlet. Go, go, you question with a wicked tongue.
Gertrude. Why, how now, Hamlet?
Hamlet. What’s the matter now?
Gertrude. Have you forgot me?
Hamlet. No, by the rood, not so!
You are the Queen, your husband’s brother’s wife,
And (would it were not so!) you are my mother.
Hamlet’s mood at this point is pretty obvious. He’s been unhappy with his mother and is letting it all out. You have my father much offended. You question with a wicked tongue. You are your husband’s brother’s wife.
If Hamlet had stormed off at this moment, having made his point, the play would have gone differently. Instead, Gertrude stands up and says, “I don’t have to take this!” and Hamlet shoves his mother back down, because he’s not done with her yet:
Gertrude. Nay, then I’ll set those to you that can speak.
Hamlet. Come, come, and sit you down. You shall not budge;
You go not till I set you up a glass
Where you may see the inmost part of you.
Gertrude is not prepared for Hamlet to put his hands on her. Remember that the whole castle believes Hamlet to have lost his mind. So it’s hardly unexpected when she yells to Polonius for help:
Gertrude. What wilt thou do? Thou wilt not murther me?
Help, help, ho!Polonius. [behind] What, ho! help, help, help!
Hamlet didn’t know someone else was in the room. He stabs blindly through the arras:
Hamlet. [draws] How now? a rat? Dead for a ducat, dead!
[Makes a pass through the arras and] kills Polonius.
Polonius. [behind] O, I am slain!
Gertrude. O me, what hast thou done?
Right now the audience is thinking the same thing that Gertrude is. What just happened? Hamlet’s a thinker and a talker, not a doer. Up to this point in the play he hasn’t really done anything. Until now. Heard a noise? Kill it!
Hamlet. Nay, I know not. Is it the King?
Gertrude. O, what a rash and bloody deed is this!
Hamlet. A bloody deed- almost as bad, good mother,
As kill a king, and marry with his brother.Gertrude. As kill a king?
Hamlet thought Claudius was hiding behind the arras! During this exchange, in fact, he still believes he has killed Claudius, which perhaps explains why he so blatantly accuses his mother of the crime, thinking that he has now avenged his father.
The timing here is subject to some debate. In the previous scene, on his way to his mother’s bedchamber, Hamlet had already passed Claudius at prayer. He has an opportunity there to kill him, but chooses not to take it. So, then, does Hamlet think that Claudius somehow beat him to the same destination? It’s possible that Hamlet took his time getting to his mother’s room eventually. Or that castles do tend to have secret passages and if there was a shortcut to Gertrude’s room, Claudius knew it. It’s also likely that in the heat of the moment Hamlet simply never thought of this.
So, Polonius’ death was an accident. What happens next is not. Hamlet hides Polonius body, refusing to let him have a proper burial. Act 4 scenes 2 and 3 are actually devoted entirely to the search for Polonius’ body:
Rosencrantz. What have you done, my lord, with the dead body?
Hamlet. Compounded it with dust, whereto ’tis kin.
Rosencrantz. Tell us where ’tis, that we may take it thence
And bear it to the chapel.
And then, when Rosencrantz and Guildenstern can get no answers out on him, Hamlet is taken before Claudius:
Claudius. Where is Polonius?
Hamlet. In heaven. Send thither to see. If your messenger find him not
there, seek him i’ th’ other place yourself. But indeed, if you
find him not within this month, you shall nose him as you go up
the stair, into the lobby.
So Hamlet uses the dead body of his girlfriend’s father as a prop so he can tell Claudius to go to hell. Is this part of his crazy act? Or at this point does he truly care so little about such things that he doesn’t think twice about defiling a corpse?