Nebular Theory
Gravitational collapse is thought to be the precipitating factor in the beginning of pre-solar nebula, in which molecular clouds begin coalescing due to the weak force of gravity. Much of this material was lighter elements, like hydrogen and helium supplemented by a small proportion of heavier elements, like gold and lead.
Formation of Stars
As these nebular discs collapsed into themselves, they begun to spin faster and faster, accelerating molecular collisions and creating heat from this agitation. The seeds of stars began to form and sustain themselves with fissile nuclear reactions, until the raw materials of elements were depleted or became stable.
Formation of Planets
Once stars formed and became sufficiently heavy and large, they became powerful gravitational sinks, attracting heavier and heavier elements in the form of undifferentiated dust. These elements begin to accrete in a different way from the material that makes up solar bodies, becoming comets, asteroids, meteorites and finally, planets. The centrifugal force eventually distinguished asteroids and the like from planets by spinning planets into spherical masses.
Formation of Moons
Previously, it was thought that moons were passing asteroid-like objects that were captured in the orbits of planets, but now there is some evidence that many moons and rings were created by collisions with young planetary bodies, forming in tandem with them. Advanced dating techniques for Earth's moon shows that it is nearly as old as the earth itself.