It's possible you're thinking of orbital resonance. This is where two celestial bodies have a gravitational relationship where their orbital periods are related by a ratio of small integers.
For example, Pluto and Neptune are in a 3:2 resonance. For every two orbits of Neptune around the Sun, Pluto completes three. This isn't them "trading orbits", but rather a complex gravitational dance.