Giant rotating clouds that collapse under their own weight produce spinning disks.
Ice-skaters spin faster when they pull their limbs in tight. The same principle applies to the collapsing cloud that formed the solar system. As a rotating cloud shrinks, it spins faster. Eventually, the rotation inhibits further collapse within a plane, forming a spinning disk of material.
These orbiting disks ultimately form planets around stars, moons and rings around planets, and stars around the centers of spiral galaxies.