Hey Annelouise – Sorry to take a while to answer. The sun formed when a cloud of dust in space pulled together from mutual gravity – all the dust particles pulled at each other till eventually they formed clumps, and then bigger clumps. When this happens the whole thing starts spinning, because the dust particles arrive from different directions at different speeds. The biggest clump is always in the middle, and if it is big enough then the gravity is huge, which means the pressure is huge too. A process called fusion started, which converts hydrogen to helium and releases a lot of energy. That’s what makes the sun both hot and give light.
When four hydrogen atoms fuse together to form helium, a tiny bit of each atom turns into energy. The amount of energy created is predicted by Albert Einstein’s famous equation: E = mc2. You don’t need to be an Einstein to understand this equation’s meaning: A small amount of stuff can turn into a huge amount of energy, under the hot conditions inside a star!
The sun is hot: ~6000°C on its surface, and ~16 million°C in the center! Fortunately, it’s just the right distance away to keep things comfortable for all life here on earth.
Hello annelouise and bluebella! The short answer on both counts is gravity! The Sun formed from a massive cloud of gas and dust (mostly hydrogen and helium) as Drew described. Gravity cause this cloud to condense into a proto-star. As the proto-star formed the center got compressed further and further. Eventually the interior became hot enough to ignite nuclear fusion and viola! A star was born. How hot is hot enough? Well the current temperature of the interior of the Sun is estimated to be around 15 million Kelvin. That is really really really hot!! The surface of our sun is hot because it is a giant thermonuclear furnace -> converting hydrogen atoms to helium in its core as Amy has described. This energy is carried to the surface layers and eventually emitted into space. Some of it even reaches Earth – enough to power most of our biosphere through energy conversion driven by photosynthesis!!