According to available evidence, Galileo Galilei never said these notoriously famous words. They are not mentioned in judiciary files from the trial, neither in Galileo’s own letters and other writings.
Portrait of Galileo Galilei, 1636
First recorded mention of this famous quote being said by Galileo comes from more than 120 years later, from notoriously inaccurate work “The Italian Library”, written by Giuseppe Baretti. However, there is a very high probability that he either imagined this event himself, or took it from other dubious sources.
“The moment Galileo was set free, he looked up to the sky and down to the ground, and, while stamping his foot, in a contemplative mood, he said, Eppur si muove, that is, and yet it moves, meaning the planet earth.“
Galileo Galilei facing the Roman Inquisition(Cristiano Banti, 1857)
If the Galileo really said these words, we can readily take for granted that it would ruin all his efforts to be proven innocent, and probably denounce him to life in prison. If he was sane, Galileo wouldn’t even consider uttering “And yet it moves” right in front of the inquisition.
We can probably attribute incredible popularity of the quote to widespread animosity against the Catholic Church, prevalent in 18.th century, bound with efforts to create martyr-like figures from the Church’s past adversaries and victims.