Planetary migration
Planets can change their distance from their star: gas in a young disc or other planets can drag a planet inward or push it out.
Planetary migration is the change of a planet's orbit after it forms. In a young disc, a giant planet exchanges momentum with the surrounding gas and can spiral inward; later, close encounters with other planets or leftover debris can move it again.
An everyday picture: a boat on a river drifts with the current until something else, such as a second boat roped to it, changes its course.
In the Grand Tack model (2011), Jupiter formed at about 3.5 AU, drifted in to about 1.5 AU, then moved back out to its present 5.2 AU once Saturn caught up. That would have scattered the rock near Mars's orbit and left Mars small. A rival idea is an early giant-planet instability: a violent rearrangement of the giant planets' orbits while the rocky planets were still forming.
A common misconception is that planets have always been where they are today. Hot Jupiters, giant planets orbiting very close to other stars, show that migration happens.
