The Sun was formed early in the history of our Solar System, about four and a half billion years ago. Gases were pulled together by gravity from a cloud of gas and dust and eventually combined to form a hot, glowing mass. This mass continued to contract under its own weight until nuclear fusion occurred. Fusion is the fusing or combining of several atoms, in this case, Hydrogen atoms, to form Helium. Photons (light "particles") are released in this process and they interact with matter in the dense CORE of the Sun, continually being absorbed and re-emitted in a "random walk" until they reach the surface of the Sun, where they stream outward at the speed of light. From the moment a photon is created in the core of the Sun until it makes it to the PHOTOSPHERE (the outer, visible layer) of the Sun, it can take a million years of "random walking." From the photosphere it only takes 8.3 minutes for that photon to reach the Earth! The Sun is currently about 75% Hydrogen and 25% Helium (by mass). That ratio will change over millions of years as the fusion process continues to make Helium out of Hydrogen.
With all this heat and light happening in the core of the Sun, why doesn't the Sun just explode? The answer is gravity. The Sun is a gas and so it can expand and contract easily. Gravity pulls the gas of the Sun together and the heat and light of the fusion process forces gas outward. These two forces are balanced and the Sun has a steady radius. If the power of fusion were to increase, the Sun would expand in size a bit. This would lower the pressure and temperature at the center of the Sun, causing fusion to slow. If fusion slowed down too much, the Sun would collapse a little and heat up the inner core, raising the fusion rate. This balance is called "hydrostatic equilibrium."
Eventually, all the Hydrogen will be used up in the fusion process, the outward pressure will decrease and the Sun will fall victim to gravity. As the Sun collapses, the Helium will start to burn at the core and Hydrogen will burn in shells around the core, and the Sun will puff up into a Red Giant, so large that the Earth will be engulfed. When all the fuel is exhausted, the Sun will shrink down to a White Dwarf and slowly fade away. But don't worry, there's still a good 5 billion years of life left to the Sun!
The photosphere is the part of the Sun that we see. Sunspots are probably the most remarkable feature associated with the photosphere. Early astronomers noticed these spots (some are many times the size of the Earth - so large that they can be seen without a telescope!) and there are records from the Chinese regarding sunspots dating back thousands of years. Once astronomers had access to telescopes, they noticed that these spots moved slowly across the Sun, and so they could determine the rotation period of the Sun. But something strange was going on... the sunspots at the solar equator were moving more rapidly than those nearer the poles! Doppler measurements of the Sun's rotation confirmed that the rotational period at the equator was about 10 days SHORTER than that at the poles. This phenomenon is called "differential rotation".
Another discovery about sunspots is that they occur in cycles. The Sun's activity cycle is 11 years long. At the minimum of the cycle, there might be no sunspots at all. At the maximum there might be 100 or more every day! Sunspots are associated with high magnetic fields that somehow keep the heat away. Sunspots are about 1200 Kelvin (1700 degrees Fahrenheit) cooler than the rest of the solar surface. Sunspots usually appear in pairs or groups, with some spots of one magnetic polarity and the other spots of the other polarity. The Sun doesn't have a simple dipole magnetic field like the Earth; it's very complex with positive and negative fields going in and out all over the Sun.
Above the photosphere is an area called the CHROMOSPHERE. This is where flares, prominences and filaments occur. Flares are caused by a sudden release in the tension of all those mixed-up magnetic fields associated with the sunspots. The positive and negative magnetic fields readjust to a more simplified form and a great amount of energy is released. Flares happen very quickly -- the energy output in X-rays can rise by several orders of magnitude in just a minute or so. Flares occur much more commonly during the maximum of the solar sunspot cycle. Prominences and filaments are actually the same phenomenon, just viewed in a different way. If you've ever seen a picture of the edge (usually called the limb) of the Sun with a huge arch of glowing material over it, you've seen a picture of a erupting prominence. It may have been labeled as a flare, but in fact, it is a lifting off of a cool region of neutral gas that's been hovering over neutral magnetic field areas. A filament is the same thing, but located on the face of the Sun, rather than the limb.
The CORONA of the Sun reaches out into space to many times the radius of the Sun. You may have seen pictures of eclipses of the Sun; the halo around the Sun is the corona. You usually can't see the corona because the surface of the Sun is so bright. The corona is very hot (about a million Kelvin - and thus very bright in the X-ray wavelengths). One of the big mysteries about the Sun is how the corona could get so hot when the surface of the Sun is so much cooler. Recent discoveries by the SOHO mission shed some light on this. It appears the magnetic field at the surface of the Sun renews itself every 40 hours! This means the amount of energy and heat poured into the corona from the magnetic field is much greater than previously thought.
Beyond the corona the Sun still has influence. The HELIOSPHERE is the region in which the Sun has greater influence than the rest of the interstellar medium; here, the solar wind is pushing interstellar dust and gas away. The edge of this region is called the heliopause and it defines the edge of our Solar System. The Voyager spacecraft have instruments on board to detect the heliopause. In 2012 and 2018 they passed through heliopause at about 122 Astronomical Units (AU - the Earth is at 1 AU) from the sun. They are the first human-made objects to travel into interstellar space!