In "Hamlet" what is Hamlet's purpose in describing to King Claudius how a king may travel through guts of a beggar?
Hamlet has been faking insanity since meeting his father’s ghost. He has a serious reason for stabbing Polonius. His mother is screaming for the guards, thinking her crazy son plans to kill her. Polonius starts calling for help behind the tapestry. Hamlet thinks he has walked into a trap and that he could get thrown into a dungeon--especially with his own mother accusing him of attempted murder and Polonius backing her up. (At this point Hamlet does not know whether his mother was involved in the murder of his father.) He might be imprisoned for years or even be executed. He pacifies his mother but still has the murder of Polonius to account for. Now, if ever, is the time to make everyone believe he is insane.
When Rosencrantz and Guildenstern ask where he has hidden the body, he refuses to tell. That would be admitting he knew he had committed murder. At the end of Act 4, Scene 3, he “runs off,” according to the stage directions, calling “Hide fox, and all after.” He pretends to think they are all playing a game. Polonius actually was hiding, and Hamlet wants them to believe he thought Polonius was the fox and that now he himself is the fox. Evidently this game was different from our modern “Hide and Seek.” Instead of everybody hiding except the boy who is “It,” only one boy would hide and everybody would look for him. The boy who found the “fox” would then become the fox himself, and this was something they all wanted to be.
Claudius believes his stepson is totally mad and thinks they are playing a game. So the wily King pretends to go along with it. Instead of asking, “Where is the body?” he smiles and asks confidentially, “Now, Hamlet, where’s Polonius?” It was a real stroke of genius for Shakespeare to have Hamlet say, “At supper.” Boys typically play games like Hide and Seek after school and such games go on until they are called in at dusk for supper.
“At supper” suggests that the game is over and now things are getting serious. It also means Polonius is alive. This terrifies the King. He only knows what Gertrude told him. He suspects a coup is underway. He is unarmed and Hamlet still has his sword. Gertrude, Rosencrantz, Guildenstern, and Polonius may all be involved in a plot to assassinate him right here and now. Gertrude is Hamlet’s loving mother. Rosencrantz and Guildenstern are his old friends and schoolmates. Polonius would love to have Hamlet marry his daughter and make her Queen Ophelia. It doesn’t matter whether Hamlet is sane or insane. If sane, he may be the leader; if insane, he may be a figurehead, a puppet, used by enemies to seize power.
Hamlet intended to frighten the King, but after enjoying the terrified reaction and the disclosure of his cowardice, Hamlet relieves the poor man by saying that the supper is not where Polonius eats but where he is eaten. It is significant that Claudius says, “Alas, alas!” He means, of course, “Alas, he’s mad!” Hamlet’s entire speech about how a man may fish with a worm that has eat of a king and eat of the fish that hath fed of that worm is merely intended to carry on the pretense that he is mad. But characteristically of all his mad utterances—and characteristically of ambiguous psychotic utterances in general—there is a second possible meaning. Hamlet seems to be implying that Claudius is “a thing of nothing” and does not have long to live.
One reason is that Hamlet is trying to keep up his appearance of being slightly insane. He's been spouting "nonsense" to people for a lot of the play now in order to keep people at a distance and put on a show of craziness so that people don't take him too seriously. This allows him to further investigate his father's murder without arousing too much serious suspicion. Hamlet's response here does serve the purpose of throwing people off, of confusing them. The king asks, "What does you mean by this?" (IV.iv.31) and finally grows frustrated and demands to know where Polonius is.
His response also is a way to put off the seriousness of what has just happened. He has murdered a man, a beloved man of the kingdom, and if he can pass it off with levity, a joke, and a bit of craziness, he might not be held accountable on the level that he would be if he was serious and remorseful for what he did.
A last purpose for his response is to make a point to the king, that all kings are worm's food in the end, and Claudius should stop thinking himself above others, including in the area of justice and getting away with things. It is a way to convey his disgust for Claudius, and perhaps foreshadow his intent to make worm's food of him. He spits in the face of Claudius, stating that he is nothing but rotting flesh that will end up in the guts of a beggar. A derisive message, and a bit ominious in its potential foreshadowing.