Can't remember the source, but the Vatican basically told Galileo that they were pretty convinced of heliocentrism, but if he could please stop shooting his mouth off until they got a transition plan in place, that'd be great.
He didn't, so they put him on lifetime house arrest to try to mitigate the damage he could do.
So he didn't get heresy'd for opposing the Church's position, but for undermining it's ability to assert influence and control.