The Catholic church created the concept based on misunderstood Bible verses and other non-Bible books. Then declared it an official doctrine.
Protestants are opposed to the whole idea, as unbiblical.
Ironically, even the Eastern Orthodox church is against it. Although in-line with the Catholic church on most things including "Mary the mother of God", they are against the Purgatory doctrine!!
Purgatory is unbiblical
It was invented by the Catholic church. Even the Greek Orthodox church is against it.
The biblical truth is
Jesus' sacrifice on the cross provided forgiveness for all "sins of the flesh" as He said in the Bible references below. And that only one sin of the Spirit is unforgivable - Blaspheming against the Holy Spirit is the only sin that is never forgivable, in this life or in the life to come; not even in a fabricated purgatory!!
Here are some of the references that were the source of confusion for the Catholic church. The church's focus in these verses was on the terms "eternal sin", "will not be forgiven in this age or the age to come", and "sins that lead to death and sins that don't":
Jesus said: 28 Truly I tell you, people can be forgiven all their sins and every slander they utter, 29 but whoever blasphemes against the Holy Spirit will never be forgiven; they are guilty of an eternal sin.” 30 He said this because they were saying, “He has an impure spirit.”
Therefore, I tell you, people will be forgiven every sin and blasphemy, but the blasphemy against the Spirit will not be forgiven. Whoever speaks a word against the Son of Man, it will be forgiven him; but whoever speaks against the Holy Spirit, it will not be forgiven him, either in this age or in the one to come.
Notes: It is very clear from both references above that "all" sins of the flesh can be forgiven in our lifetime - "can be forgiven" meaning depending on the person's position towards God, as in humbling ourselves to God, or rejecting God. The forgiving of the "sins of the flesh" can only be done in our lifetime through the blood of Jesus. All sins of the flesh can be forgiven, not some of them.
But as for the eternal sin, only blaspheming against the Spirit is never ever forgivable. So, for the church to offer forgiveness to some "sins of the flesh" after death would be contradicting to everything God did to provide complete salvation through the sacrifice of Jesus. It is completely against the rest of thousands of pages of the Bible.
1 John 5:16-17
“If anyone sees a fellow believer committing a sin that doesn’t lead to death, he should ask, and God will give life to him - to those who commit sin that doesn’t lead to death. There is sin that leads to death. I am not saying he should pray about that. All unrighteousness is sin, and there is sin that doesn’t lead to death.”
Notes: And this reference talking about death sin and not-death sins totally confusing the church. But it is not saying anything contradicting to the 2 references above.
The Catholic Church Point of View
The above references completely confused the Catholic church, and drove it to look for more references supporting their purgatory idea, both in the Bible and in other books! The one verse that drove the pope to make it official was, Matthew 12:32: "but whoever speaks against the Holy Spirit, it will not be forgiven him, either in this age or in the one to come." Their reasoning: "If this sin cannot be forgiven after death, it follows that there are other sins which can be forgiven after death, and this must be in some form of a purgatory". But this is so misunderstood. Again, these are a bunch of people not filled with the Holy Spirit, and yet making big decisions.
The confusion resulted in the church making up their own list of "death sins" and "not death sins". Example, "lying" is not a death sin, "killing" is a death sin, "adultery" is a death sin, etc.. To resolve this salvation dilemma, they introduced "Purgatory". According to Catholic teaching, because the sin that leads to death is not one we can pray about and get forgiven in this age (ie, before death), the Catholic church advised a place of suffering that people go to after death for a period of time for redemption, then on to heaven from there. A place similar to hell, but not as painful - purgatory. The Catholic church declared the purgatory doctrine around the 12th century based on some misunderstood verses and also referencing a non-biblical book called "Maccabees", an old Jewish book not part of the Bible. This is completely unbiblical. It's another human doctrine to please people; as in: "Don't worry, the church got your eternity covered, if you commit death sins, you just swing by Purgatory and get slapped around some, then on to heaven. Not so bad, keep donations coming." Again here the Catholic church over-extended their power of the "bounding and loosening" in Matthew 18:15-19.
Here's an internet link listing the references that are supposed to support Purgatory. I don't see anything here that supports Purgatory. Only misunderstood verses that they twisted in their direction. The link also references the unbiblical books of Maccabees twice, which that alone discredits the whole doctrine: Catholic Purgatory Internet Reference
The Explanation Why It's Not Biblical
The first observation is that Jesus clearly said "only one sin is unforgivable", which is the same as the "death sin" in 1 John 5:16-17. There is no list of unforgivable death sins; only one.
There was nothing in the above verses that alluded to some "sins of the flesh" to be forgiven in this age and some in the next. It would be a stretch to try to read it that way. The reading more in line with the whole scripture would be that all non-Spirit sins are forgivable in this age, by the blood of Jesus. To take a stretch of an explanation and turn it into a doctrine would be obnoxious and a clear indication of how Godly their intentions were. Why would the pope and his bunch want to go to such extremes to say that some sins of the flesh are not forgivable in this age by the blood of Jesus? That you still need to suffer somewhere to get the full pardon. As in, "you can't just get off so easily after sinning all these horrible sins of the flesh." A clear lack of knowledge of God! The pope and his assistants did not seek God. They were more filled with their own arrogance, public stature, and earthly politics than seeking God.
My Biblical View
If I was asked for the meaning of that verse from Jesus, "but whoever speaks against the Holy Spirit, it will not be forgiven either in this age or in the one to come", with wisdom from God, I would explain it like this:
Lucifer was a perfect angel in heaven. Then he declared himself god above God. That was an unforgivable sin of the Spirit committed in heaven. So God cast him out of heaven to "eternal" hell with no chance of repentance. People will have free will in heaven. Although we'd become incapable of sinning earthly sins, the freewill would keep a potential for us to commit the sin of the Spirit in heaven, just as the angel Lucifer did and was never forgiven. Although not likely for us, such a possibility would drive Jesus to include "the next age" in His statement.
The Lucifer reference in Isaiah:
How you have fallen from heaven, O Lucifer, son of the dawn! You have been cast down to the earth, you who once laid low the nations! You said in your heart, “I will ascend to the heavens; I will raise my throne above the stars of God; I will sit enthroned on the mount of assembly, on the utmost heights of Mount Zaphon. I will ascend above the tops of the clouds; I will make myself like the Most High.” But you are brought down to the realm of the dead, to the depths of the pit.
We keep praying and seeking God. And He will reveal the answers to us at the right time.