There are all sorts of issues I have with what and the way you were taught this history. There are many common misconceptions about the Catholic Church.
First until the 11th Century there was only one Church, After that time the schism which gives us the separation between the various Orthodox Churches, which are for the most part drawn on national lines, and the Catholic Church which has both Eastern and Latin (Western Rites) all unified with the Pope. All the historic, or Apostolic Churches (Orthodox, Armenian Apostolic and Catholic) as well as a the Monophocite Groups like the Copic, Ethiopian, and some Syrian Churches believe (as laid down in scripture) that Jesus gave the Apostles the authority to forgive sin in His name. They also believe that the Apostles passed on this authority to those they ordained by the laying on of hands. So it is not a new teaching of the Catholic Church that developed over time, but is traced back to the Apostles and the Bible.
Infallibility is often confused with Impeccability. Impeccability is the belief that a person can never sin. The Church does not claim that for anyone from the Pope on down. Infalliblity as the Church sees it is that when the Church teaches officially to all Christians in the world on a matter of Faith or Morals, God grants that they will not teach error. This is manifest in three different ways. Extrodinary, When the Pope declares something officially to be a doctrine, or moral decision, and he does so to the ENTIRE CHURCH, in the FULLNESS of his Apostolic Authority, making it clear that it is binding on all Christians. Most theologians can only point out this having happened twice in the entire 2000 years of Church History. Another way the Church teaches infallibly is when the bishops all meet in a council, and the council decisions (on faith and morals) are affirmed by the Pope. The third is when any bishop or priest united with the Pope teaches what the Church teaches.
In the case of indulgences and other things that people in the Church did, that was not an infallible action. The fact is that the Church forbids and did forbid the sale of any holy thing, ie Sacraments, Indulgences or blessings, as the sin of Simony (after Simon who wanted to buy the power to heal from the Apostles) If an individual or group teaches something contrary to what the Church teaches, as J. Tetzel did, it is he and not the entire Church that is in error. If the Pope speaks on the subject of Quantum Physics, (Not a matter of Faith you know) or to a small group of people about his personal theological opinions, he can because he is speaking as a private individual, and not in his official position as Pope, make an error, and is not protected by the charism of Infallibility. Like everyone else in the Church the Pope, and all the Bishops, priests and deacons are humans, who sin, and err, who need to go to confession, and be sorry for their sins.