From Chris Bellitto's book 101 Questions & Answers on Popes and the Papacy.
Question 35: Did a pope really condemn Galileo for saying the earth revolves around the sun?
Excerpt from answer: Kind of. The issue was less about astronomy and science than authority. The pope in question was a complex man, Urban VIII (1623-44): a very well-educated aristocrat, humanist, diplomat, patron of artists and architects and generous supporter of missions and evangelization, but also a pope guilty of nepotism, greed, absolutist tendencies, and poor political decisions.
As long as Galileo asserted the idea of the earth revolving around the sun was an experiment or hypothesis, he was left alone. When Galileo (stated the sun as center of the solar system as scientific fact) he ran into trouble because it conflicted with the church notion of the church as the center of the universe.
To jump a few centuries ahead: the rehabilitation of Galileo was one of the earliest tasks John Paul II explored. The pontifical commission he ordered to reopen the case concluded in 1992 that Galileo's critics had misunderstood scripture and mistakenly taken it as not only fact, but religious doctrine, that the earth must be the center of the universe. As a result, John Paul II declared the church had made a mistake in condemning Galileo.