A giant dusty cloud collapsed under its own gravity, spinning faster and flattening into a disk, with the densest region at the center becoming the Sun, and dust clumping to form rocky protoplanets closer to the Sun and gas giants further out, which then collided and merged to become the planets we see today