Over four billion years ago, our solar system was a whirling cloud of dust and gas (aka a nebula). Eventually, this cloud collapsed.
It’s theorized that this happened because of a shockwave from a nearby star. When this collapsed in on each other, gravity caused all the matter to start clumping together in the middle (it also started spinning).
That material first became what is called a protostar. A protostar is a mass of helium and hydrogen that is not yet powered by fusion. Over millions of years, the temperature and pressure at the center continued to rise.
The part that happens next explains why the star we call the sun was formed, rather than remain as just a lump of gas.
The matter in that lump was all pushing down on its center. The bigger it grew, the more pressure there was on the core. Eventually, the pressure got to be so great that hydrogen atoms in the core were crushed together, and fused into another element, helium. When they fused, a lot of energy was released. That energy is what makes the Sun burn.
Planets do form the same way stars do. While in our solar system, the sun took up approximately more than ninety-nine percent of the matter in that disc, the leftovers also clumped together. Although planets may seem huge, especially in comparison to a person, they just aren’t big enough to crush helium and have cores capable of nuclear reactions.
Sources And Further Reading:
“How did the solar system form?” NASA SpacePlace. March 21, 2015. Accessed January 9, 2017.
Redd, Nola Taylor. “How Was the Sun Formed?” Space.com. January 17, 2013. Accessed January 09, 2017.
“Stars.” NASA Science (Beta) . Accessed January 9, 2017.