Rosencrantz and Guildenstern tell the Queen and King about their encounter with Hamlet. the King is happy that Hamlet is interested in the play.
Polonius sets Ophelia and Hamlet up so they can meet. This way Polonius and the King can confirm Hamlet's madness is indeed due to Ophelia's rejection.
Hamlet is questioning if he should live or die. Hamlet sees Ophelia and starts talking, but soon realizes he is being spied on and Ophelia is part of the setup. Hamlet decides he can't trust Ophelia or women overall anymore.
During the play, the King couldn't contain his guilt and leaves. Hamlet gets the reaction he wanted, now he is certain his uncle killed his father and can go get his revenge.
Claudius feels so bad he tries to pray but he can't. Hamlet is willing to kill his uncle at that moment. Hamlet decides to do it in another moment where he will be sinning. thinking Claudius was praying and that he would send him straight to heaven.
Hamlet goes to his mother's chambers to confront her. He wants her to see her wrongdoings. Hamlet hears a noise and thinking it was the King hiding, accidentally stabs and kills Polonius.