An epicycle is a term from the Ptolemaic system of astronomy. The epicycle was designed by Apollonius of Perga at the end of the 3rd century BC as a geometric model to explain the variations in speed and direction of the apparent motion of the Moon, Sun, and planets. In particular it explained retrograde motion.
In the Ptolemaic system, the planets are assumed to move in a small circle, called an epicycle, which in turn moves along a larger circle called a deferent. Both circles rotate counterclockwise and are roughly parallel to the Earth's plane of orbit (ecliptic).
The deferent would be considered to be centered on the Earth (as the planet was believed to be in orbit around Earth... see: geocentric universe).
As viewed from Earth, the planets were seen as mostly moving eastward along the deferent. Half of the time, the added motion along the epicycle was eastward, in parallel with the eastward movement of the epicycle on the deference. However, at times the planet would move along the epicycle in an opposite direction to the motion of the epicycle along the deferent. This would cause the planet to slow down and reverse course, ie. retrogradation.