Hamlet evolves because he decides to take action against his uncle. Though once he was confused and more peaceful, he is now determined to kill his uncle and feels anger. He doesn't even seem to care when he accidentally kills an innocent man.
In his third soliloquy, Hamlet isn't sure what to do. He asks himself whether it's better to live or die. He realizes that fear of death is what makes people cowards—it prevents them from taking action.
When the play within a play makes him realize beyond the shadow of a doubt that his uncle is guilty, he decides that he will take action. Until this point in the play, Hamlet wasn't sure what to do. He didn't want to do the wrong thing. Now, though, he knows that he will set himself on a course to kill his uncle and avenge his father. This clarity and assurance are what drives him to almost kill Claudius. He shows he still has some principles when he decides not to do so because Claudius is praying.
When he attempts to kill his uncle after confronting his mother and instead kills Polonius, Hamlet doesn't care about the man's death. His desire for revenge has driven away any doubts or focus except on his goal: ending the life of Claudius. Hamlet seemed to care more about other people before the third act. He goes from being a peaceful man to a vengeful one once he is sure that Claudius is the guilty party.