If a planet were to leave its own solar system, it would most likely be due to a gravitational interaction with another celestial body. Such an event could occur if the planet gets too close to a massive object like another star or a black hole, which can disrupt its orbit and eject it from its original system.
When a planet is ejected from its solar system, it becomes a rogue planet or an interstellar planet. It would continue to drift through the vast