Mercury and Venus are never far from the sun, as seen from Earth. Venus is never more than 48° away from it, while Mercury’s greatest separation is 28°. This is in contrast to every other planet, which can be a full 180° away from the sun.
Ever since Copernicus, we know this is because Mercury and Venus orbit the sun more closely than the Earth. The Earth can never be directly between the Sun and Mercury or Venus, unlike the other planets.
But before Copernicus, the most widely held model of the solar system was geocentric. And despite having complicated epicycles, it did actually make accurate predictions about where the planets would appear, so I can’t believe that medieval astronomers didn’t notice that Mercury and Venus never stray far from the Sun.
So, did they have an explanation for why that was the case, or did they chalk it up to coincidence?
The distance issue was not the sticking point. If the Sun, Mercury and Venus all orbited with about the same period, then they could coincidentally stick close together. You need variable speeds to have the planets overtake then fall behind the sun. That is what Ptolemy suggested.
But to get the change in phases seen on Venus you’d need Venus to also move somewhat farther away and closer. That didn’t sit well with the ancients who wanted the orbits to be perfect circles. Between Ptolemy and Copernicus, there was an intermediate model in which everything orbited the Earth including the sun bu excepting Mercury and Venus which did orbit the sun.
While we’re at it, the Ptolomaic model also accounted for the fact that the other planets sometimes moved retrograde, and that they were at their brightest when they did so, but did not account for the fact that this happened exactly when they were opposite from the Sun in the sky.