Well, that’s quite a mouthful! Welcome to the forums, and let me see whether I can help.
Papal infallibility has been described in many, many ways. Some of them are even accurate. But most of them are wrong.
First, the charism of infallibility isn’t what you’ve been led to believe. The Pope isn’t perfect, not everything he says come from God, and not everything he says is infallible. The Holy Spirit guides the Church and prevents it – most especially the Pope – from announcing incorrect doctrines of faith and morals. That’s all. The Pope can’t predict the winning lottery number; if he was a poor speller before joining the priesthood, he’s still a poor speller; if he thinks the stock market will go up, he’d better consult an expert before investing, just like everyone else.
But, when he speaks
ex cathedra ('from the chair" of Peter (a metaphor referring to his place as head of the Church under Christ)) about faith and morals, the Spirit prevents him from misleading Christians as to their duties to God and each other. This “infallibility” (perhaps better characterized as preservation from error) extends to the bishops of the Church when acting as a whole in communion with the Pope.
So, for example, when the Council of Jerusalem taught that circumcision was not required of Christians (see Acts chapter 15), the bishops gathered together could not teach incorrectly. And when the bishops gathered at the Council of Nicea and explained that Jesus was both fully human and fully divine, they taught infallibly – that is, they were incapable of teaching falsehood, just as when, years later, the bishops gathered at the Council of Constantinople and explained that the Holy Spirit is of one being with the Father and the Son.
As for Scriptural references, try Luke 10:16: “He that heareth you, heareth me; and he that despiseth you, despiseth me; and he that despiseth me, despiseth him that sent me.” Or Matthew 18:18: “Amen I say to you, whatsoever you shall bind upon earth, shall be bound also in heaven; and whatsoever you shall loose upon earth, shall be loosed also in heaven.”
Or:
And Jesus answering, said to him: Blessed art thou, Simon Bar-Jona: because flesh and blood hath not revealed it to thee, but my Father who is in heaven. And I say to thee: That thou art Peter; and upon this rock I will build my church, and the gates of hell shall not prevail against it. And I will give to thee the keys of the kingdom of heaven. And whatsoever thou shalt bind upon earth, it shall be bound also in heaven: and whatsoever thou shalt loose upon earth, it shall be loosed also in heaven.
Matthew 16:17-19.
But Jesus’ promise that the Spirit would guide and protect the Church does not mean that individual members of it would be free from sin. Popes make mistakes all the time. Some popes did terrible things and sinned grievously against God.
But, when they taught faith and morals in His name, they taught correctly.