The sun is a main sequence star, which means it is powered through the process of nuclear fusion. Nuclear fusion is the process of multiple (two or more) nuclei combining to form a completely different nuclei. This process occurs under extreme conditions and releases immense amounts of energy.
The sun, at its core (literally), is just a ball of burning gas. The core of the sun is made up mostly of hydrogen atoms, which are just lone protons, and the heat of the sun cause these hydrogen atoms to fuse together and turn into helium atoms. This process emits a tremendous energy. The heat and light that the sun sends across our solar system is the result of energy radiated from its core.
The sun emits astronomical amounts of energy, and does not destroy the solar system in the process. So, why don’t we try to replicate this power on Earth? Well, fusion power has been an idea since the 1940’s. The issue with it, is that nuclear fusion can only occur under extreme temperature and pressure. The sun does this naturally, but for these conditions to be possible on Earth, it requires a ton of energy. We use electrical energy to create the conditions to produce nuclear energy. Since, these conditions are so difficult to obtain, there is actually a net negative energy output while trying to start the nuclear fusion process. Although it is not practical yet, I am hopeful that one day we will be able to replicate the sun’s energy source, and feasibly have fusion power on Earth.