Claudius is alarmed by the play. He interrupts the performance and flees from the room, making himself look conspicuous and rather foolish. Hamlet's mother sends for her son with the intention of reprimanding him for putting on a play which might seem to suggest that Claudius murdered his brother to get the throne. With the King's consent, Polonius volunteers to hide behind the tapestry in Gertrude's room to eavesdrop on their conversation. Polonius can hear everything but can't see a thing. The crucial moment comes when Hamlet grabs his mother by the arm and forces her to remain seated. He says, "You go not till I set you up a glass / Where you may see the inmost part of you." This, of course, is a metaphor, but Gertrude already thinks her son is mad. He is wearing a sword. He is acting strangely and she feels threatened. She takes his statement literally and get the idea that he intends to cut her open and show her her own insides in a mirror, which is something a madman might think of doing. She calls for help. Polonius echoes her cries. Hamlet thinks he has walked into a trap and that he will be arrested and thrown into a dungeon by the palace guards, where he could be held prisoner indefinitely or killed. This is what impels him to stab Polonius. The murder of Polonius makes Claudius decide to send Hamlet to England with sealed orders carried by Rosencrantz and Guildenstern to execute Hamlet immediately upon his arrival. Hamlet returns to Denmark because he never got to England, having been kidnapped by pirates and then ransomed. The death of Polonius also leads to Ophelia's madness and apparent suicide as well as to Laertes violent assault on Claudius, who persuades Laertes to kill Hamlet instead. The play called "The Murder of Gonzago" therefore leads directly to Hamlet's death by Laertes' poisoned foil. The play may have succeeded in proving what Hamlet wanted to find out, but it also motivated Claudius to plot his nephew's murder.
A couple of things happen. One involves Gertrude and the other involves Claudius. In Hamlet's 2nd soliloquy he remarks that the First Player could "make mad the guilty and appal the free." After the play breaks up we are told that the king "is in his retirement marvellous distempered." and the queen is struck with "amazement and admiration." Here admiration means astonishment. Gertrude "in most great affliction of spirit" has sent for Hamlet. We know that while in Gertrude's closet, Hamlet stabs and kills Polonius. This sets in motion the subplot of Laertes revenge against Hamlet. As for Claudius he now knows that Hamlet is truly dangerous. I would not presume that Claudius knows that Hamlet knows the details of his father's death, but what the play did show was the enactment of a nephew killing a king. Claudius' path to the throne involved murder and he justifiably imputes that on Hamlet. The play has made enemies of Claudius and Laertes and they both combine their efforts to bring down Hamlet.