Our solar system
The Solar System formed from the gravitational collapse of a giant molecular cloud 4.568 billion years ago. This initial cloud was likely several light-years across and probably birthed several stars. It consists of the Sun and the astronomical objects gravitationally bound in orbit around it.
As the region that would become the Solar System, known as the pre-solar nebula, collapsed, conservation of angular momentum made it rotate faster. The centre, where most of the mass collected, became increasingly hotter than the surrounding disc. As the contracting nebula rotated, it began to flatten into a spinning protoplanetary disc and a hot, dense protostar at the centre. At this point in its evolution, the Sun is believed to have been a T Tauri star. T Tauri stars are often accompanied by discs of pre-planetary matter. The planets formed by accretion from this disk. (Accretion means 1. the growth of a massive object by gravitationally attracting more matter, typically gaseous matter in an accretion disc & 2. the collision and sticking of cooled microscopic dust and ice particles electrostatically, in protoplanetary discs and Gas giant protoplanet systems, eventually leading to planetesimals which gravitationally accrete more small particles and other planetesimals.)
Within 50 million years, the pressure and density of hydrogen in the centre of the protostar became great enough for it to begin thermonuclear fusion. The temperature, reaction rate, pressure, and density increased until hydrostatic equilibrium was achieved, with the thermal energy countering the force of gravitational contraction. At this point the Sun became a full-fledged main sequence star.
As the Sun burns through its supply of hydrogen fuel, the energy output supporting the core will continue to decrease, causing the Sun to collapse in on itself. The increase in pressure heats the core, so it burns even faster. As a result, the Sun is growing brighter at a rate of roughly ten percent every 1.1 billion years.
Around 5.4 billion years from now, the hydrogen in the core of the Sun will have been entirely converted to helium, ending the main sequence phase. As the hydrogen reactions shut down, the core will contract further, increasing pressure and temperature, causing fusion to commence via the helium process. Helium in the core burns at a much hotter temperature, and the energy output will be much greater than during the hydrogen process. At this time, the outer layers of the Sun will expand to roughly up to 260 times its current diameter; the Sun will become a red giant. Because of its vastly increased surface area, the surface of the Sun will be considerably cooler than it is on the main sequence (2600 K at the coolest).
Eventually, helium in the core will exhaust itself at a much faster rate than the hydrogen, and the Sun’s helium burning phase will be but a fraction of the time compared to the hydrogen burning phase. The Sun is not massive enough to commence fusion of heavier elements, and nuclear reactions in the core will dwindle. Its outer layers will fall away into space, leaving a white dwarf, an extraordinarily dense object, half the original mass of the Sun but only the size of the Earth. The ejected outer layers will form what is known as a planetary nebula, returning some of the material that formed the Sun to the interstellar medium.