From antiquity, the majority of educated people subscribed to the Aristotelian view of geocentrism that the earth was the center of the universe and that all heavenly bodies revolved around the Earth. Despite the use of Copernican theories to reform the calendar in 1582, this agreed with a literalist interpretation of Scripture in several places, such as 1 Chronicles 16:30, Psalm 93:1, Psalm 96:10, Psalm 104:5, Ecclesiastes 1:5. Further, since it was believed that in the incarnation the Son of God had descended to the earth and become man, it seemed fitting that the Earth be the center around which all other celestial bodies moved. Heliocentrism, the theory that the Earth was a planet, which, along with all the others, revolved around the Sun, contradicted both geocentrism and the prevailing theological support of the theory.
1 Chronicles 16:30
Tremble before him, all the earth!
The world is firmly established; it cannot be moved.
Psalm 93:1
The LORD reigns, he is robed in majesty;
the LORD is robed in majesty and armed with strength;
indeed, the world is established, firm and secure.
Psalm 96:10
Tell all the nations, "The LORD reigns!" The world stands firm and cannot be shaken. He will judge all peoples fairly
Psalm 104:5
He set the earth on its foundations; it can never be moved.
Ecclesiastes 1:5
The sun rises and the sun sets, and hurries back to where it rises.
The Church
You wouldn't think that those were conclusive statements that the Earth was the center of the Universe, but that had been taken for granted for so long that the Bible had traditionally been interpreted in that way.
"...interpreting heliocentrism as physically real would be a very dangerous thing, likely not only to irritate all scholastic philosophers and theologians, but also to harm the Holy Faith by rendering Holy Scripture as false."
The Telescope
Galileo had looked through the newly invented telescope and saw moons orbiting Jupiter, mountains on the Moon, and sunspots on the sun. It was immediately obvious that if there were bodies that were not orbiting Earth, then geocentrism (the idea that the Earth is center of Universe) was in trouble and that Copernicus' model of planets orbiting the sun (heliocentrism) was more likely. And sunspots contradicted the dogma that the sun was perfect, unmarred, just like God.
The Jesuits
The Jesuits had their own astronomers, with their own telescopes. They too saw the moons of Jupiter, the mountains on the moon, sunspots etc. But the Jesuit leaders refused to look, according to a letter Galileo wrote to another astronomer, Kepler.
The Inquisition
Galileo was found guilty by the Inquisition and the sentence issued on 22 June 1633, was in three essential parts:
Galileo was found "vehemently suspect of heresy," namely of having held the opinions that the Sun lies motionless at the centre of the universe, that the Earth is not at its centre and moves, and that one may hold and defend an opinion as probable after it has been declared contrary to Holy Scripture. He was required to "abjure, curse, and detest" those opinions.
He was sentenced to formal imprisonment at the pleasure of the Inquisition. On the following day this was commuted to house arrest, which he remained under for the rest of his life.
His offending Dialogue was banned; and in an action not announced at the trial, publication of any of his works was forbidden, including any he might write in the future.
According to popular legend, after his abjuration Galileo allegedly muttered the rebellious phrase And yet it moves, but there is no evidence that he actually said this or anything similar. The first account of the legend dates to a century after his death.
The Church Changed 150 Years Later
In 1758 the Catholic Church dropped the general prohibition of books advocating heliocentrism from the Index of Forbidden Books. It did not, however, explicitly rescind the decisions issued by the Inquisition in its judgement of 1633 against Galileo, or lift the prohibition of uncensored versions of Copernicus's De Revolutionibus or Galileo's Dialogue. As a result, the precise doctrinal status of heliocentrism remained unclear, and many Catholic scientists continued to pay lip service to the view that it could only be treated as a hypothesis. Others, however, openly endorsed it as an established fact without meeting any official opposition from the Church.
The issue finally came to a head in 1820 when the Master of the Sacred Palace (the Church's chief censor), Filippo Anfossi, refused to license a book by a Catholic canon, Giuseppe Settele, because it openly treated heliocentrism as a physical fact. Settele appealed to the then pope, Pius VII. After the matter had been reconsidered by the Congregation of the Index and the Holy Office, Anfossi's decision was overturned.
The Church Recanted Another 250 Years After That
In 1992, it was reported in the news that the Catholic Church had turned around towards vindicating Galileo:
Thanks to his intuition as a brilliant physicist and by relying on different arguments, Galileo, who practically invented the experimental method, understood why only the sun could function as the centre of the world, as it was then known, that is to say, as a planetary system. The error of the theologians of the time, when they maintained the centrality of the Earth, was to think that our understanding of the physical world's structure was, in some way, imposed by the literal sense of Sacred Scripture....
- Pope John Paul II, L'Osservatore Romano N. 44 (1264) - November 4, 1992
In 2000, Pope John Paul II issued a formal apology for all the mistakes committed by some Catholics in the last 2,000 years of the Catholic Church's history, including the trial of Galileo among others
Join The Dots
It took 400 years to get the Church to finally admit that the scientific evidence was correct; the scriptural interpretations of the Bible were wrong.
And that was with evidence right in front of their eyes. ("No I'm not going to look at your 'evidence'. It might corrupt my faith in the infallibility of the Lord so I'm just going to pretend it doesn't exist.")
Galileo's story wasn't a pure religion/science battle - there were aspects of personal feuds and payback (Galileo was a sarcastic and arrogant debater, who made many powerful enemies. But the relevant aspect was the way that churchmen preferred their biblical interpretations even when directly contradicted by evidence.
How long do you think it will take the latest crop of science-deniers to recognize the hole they've dug for themselves?