Over the past 200 years, a standard model has emerged to explain how solar systems form. Using our own solar system as a guide, the model explains the existence of a central star (our Sun), an inner system of rocky, "terrestrial" planets, and an outer system of "gas giant" planets, all orbiting in nearly the same plane of rotation as the central star.
Recent discoveries of planetary systems around other stars have challenged this model. These exoplanet discoveries have included gas giant planets in close orbit around their stars, some of which are in radically different planes of rotation from their primary stars. [The Strangest Alien Planets]
In the generally accepted model for solar system formation, everything begins with a nebula (or cloud) containing gas and dust. Gravitational attraction causes the cloud to collapse, and if the collapse is less than perfectly symmetric, angular momentum will lead the cloud to form a nearly flat rotating disk.
The greatest concentration of material collects at the center of the disk, forming a protostar, while protoplanets may form at some distance from the center around areas of higher than average density within the disk. When the protostar eventually collects enough matter, fusion reactions begin and it becomes a young star, heating the inner portion of the disk and vaporizing any gases that may have collected – which naturally explains why planets that form near the star are rocky.