Claudius was praying and repenting for his sins. Resulting in Hamlet deciding not to through with it, because after all, if he had, Claudius would’ve been forgiven of his sins and sent directly to heaven, in addition to not wanting to feel guilty or come under the wrath of God for killing him under those circumstances.
In act 3, scene 4, Hamlet takes a whole opposite approach; going full force with no remorse, as if killing Claudius in that moment would’ve been more justified that then before. Hamlet even went as far as to say that if killing Polonius meant that he would’ve killed Claudius – had it been him – it was worth it.