Galileo was tried by the inquisition for heresy, not sloppy science. As this site indicates, the charges were based on scripture.
The charge was indeed heresy. It had to be since it was a Church tribunal. Nonetheless the idea that the sun orbits the earth originally came into the Church from non-Christian sources. Church leaders then found some vague Biblical passages to justify them, though not one of those passages actually says the sun orbits the earth. Greek ideas were all the rage during that time. They were sort of the secular humanist ideas of that era, and the Church picked many of them up the same way that many churches today adopt faddish ideas.