The explanation and the animated pictures attached below are taken from the website:
The model of the solar system developed by Ptolemy (87 - 150 A.D.) was a refinement of Aristotle's (384 - 322 B.C.) universe. This model consisted of a series of concentric spheres, with the Earth at the center (geocentric). The motions of the Sun, Moon, and stars was based on perfect circles. To account for the observed retrograde motion of the planets, it was necessary to resort to a system of epicycles, whereby the planets moved around small circular paths that in turn moved around larger circular orbits around the Earth.
In its final form, the model was extremely ...