Rev 21:27 states "But nothing unclean shall enter it, nor any one who practices abomination or falsehood, but only those who are written in the Lamb's book of life."
It is with this passage that the Catholic sees many of those dying are not wholly "clean." But carry with them baggage from this earthly existence. whether it be an inordinate attachment to pride, or sex, or sports, or whatever. These things get in the way of ones relationship with the Almighty.
After death, at the judgement, we are judged on these things. God sees not so much sins, as He sees one is not quite ready to enter the heavenly banquet due to the fact that one hasn't fully detached oneself from earthly goods. That is where Purgatory comes in.
"For out of the heart come evil thoughts, murder, adultery, fornication, theft, false witness, slander. These are what defile a man; but to eat with unwashed hands does not defile a man" Matt 15:19-20 (RSV).
This is un uncleaness of heart. We again refer to the Revelation passage above, that says nothing defiled can enter heaven. If that is true, and it must be since it is God's Word, then any one who does those things (evil thoughts, murder, adultery, fornication, theft, false witness, slander) are unclean.
this list probably convicts all of us in one area or another! NOTHING DEFILED CAN ENTER HEAVEN according to Revelation 21:27, thus there must be a place to cleanse us of this 'uncleanliness' prior to our entering the banquet feast.
That is is what we call Purgatory!