Ptolemy’s theory of epicycles (orbits within orbits within orbits…) was used to explain the strange motion of the planets, which sometimes flipped back on their own paths, instead of following simple patterns. At the same time, crucially, his theory allowed the Earth to remain the centre of the universe.
The problem is that Ptolemy’s theory can be used to justify any set of orbits, because the epicycles can be adjusted to describe any path. Indeed, a sufficiently complex and honed set of epicycles can even describe a planetary path that draws an outline of Homer Simpson.
More about epicycles here and in loads of other places.