Does mass or density affect a planet's orbit?

Let’s say you have two planets sharing an orbit around their star and they start off at opposite ends of the orbit. One planet has more mass than the other. Does it go faster or slower because of this? Will it eventually catch up with the other planet and crash into it?

Remember Galileo’s Leaning Tower of Pisa experiment? The mass of an object has no influence on its rate of fall in a vacuum (which is what an orbit is - falling at orbital velocity in a vacuum)

The mass of the planet makes almost no difference. Remember, though, that not only does the star attract the planet, the planet attracts the star, too, so if a planet’s mass is a significant fraction of the mass of the star, it can matter (what constitutes “significant” depends on just how precisely you’re measuring).

Then, too, though, even if both planets have the same mass, and it’s much, much less than the mass of the star, one will still end up going faster than the other and catching up to it. There are stable ways to arrange planets, but two planets on opposite sides of the same orbit isn’t one of them: If some tiny perturbation (and in the real world, there are always tiny perturbations of some sort or other) puts one of them slightly out of position, it’ll slide more and more out of position in a runaway process.

Now, the really interesting part of this is what happens when the faster planet catches up to the slower one. They don’t crash together (though they do, technically, collide). What happens is that the two planets interact in such a way that the fast planet slows down a bit, and the slow planet speeds up a bit, and the formerly-slow planet takes off away from the formerly-fast planet, until it eventually laps it and the process repeats. This is famously the situation for Saturn’s moons Janus and Epimetheus.

Well I don’t know for famously, but that’s pretty darn interesting.

If a marble were in the Earth’s orbit, it would take a year and 47 seconds to go around the Sun.

Ok, thanks.
I knew that there were a pair of moons in the solar system that shared an orbit under peculiar circumstances but I couldn’t remember which or around what planet.