The Pope encouraged Galileo to write a book about the issue and cover both sides in neutrality. Galileo did write a book, but was rather on the Asperger's side of social behavior, and decided to frame the geocentric position (which aligned with the Pope) as idiotic, defended by an idiot - named Simplicio no less, and presented weak and easily dismantled arguments. The Pope took it as a personal insult, which it was, and the rest is history.
And notably Galileo's theory was, in general, weak. Amongst many other issues he continued to assume perfectly circular orbits which threw everything else off and required endless epicycles and the like. So his theory was still very much in the domain of philosophy rather than observable/provable science or even a clear improvement, so he was just generally acting like an antagonistic ass to a person who had supported him endlessly. And as it turns out even the Pope is quite human.