Through the atoms of progenitor stars long since gone supernova. Probably neutron stars too!
Or also by chance?
I know tidal curves have increase the moons orbit, I’m struggling to think of anything (outside massive collisions) that would cause planets to move closer to their stars, or move to new ones.