Why do the orbits of the major planets tend to stay very close to the ecliptic plane?

Answer

Because the solar system formed from a rotating disc of gas and dust

The striking near-alignment of the major planets' orbits around the Sun, making the ecliptic such an effective reference, stems directly from the solar system's accretion history. The system originated from a massive, rotating, flattened disc composed primarily of gas and dust orbiting the nascent Sun. As gravitational forces caused this material to condense and form the planets, the resulting bodies inherited the angular momentum and planar orientation of that original rotating disc. Therefore, the major planets orbit nearly within the same flat surface established by that primordial cloud.

Why do the orbits of the major planets tend to stay very close to the ecliptic plane?
Spacesunorbitsatellitepath