The sun, like all stars, is really a giant nuclear reactor. But unlike the reactors we have here on Earth, they don't release energy through nuclear fission. In fission, we split large, heavy atoms to release massive amounts of heat. That heat then turns water into steam, which is used to push turbines and generate electricity.
Stars are nuclear fusion reactors, meaning the process taking place in the core of a star involves fusing two atoms to make a new one. In that process, lots of energy gets released. And nuclear fusion doesn't produce nasty nuclear waste the way fission does. The materials used aren't dangerously radioactive either before or after fusion.
The reason we don't have fusion reactors powering everything here on Earth is because it requires a lot of energy to get things started. You have to strip away electrons from atoms to allow the atomic nucleuses to get close enough to fuse. Stars have advantages -- they are enormous, incredibly hot and dense. It's not easy to simulate those conditions on Earth. Early fusion reactor experiments ran into a big problem: It took more energy to get fusion started than was produced by the fusion itself. In other words, it was a net loss for energy.
Researchers have made some progress in getting more energy out of fuel, but no one has managed to make a reactor that reaches ignition status. That's when the reactor generates enough energy to maintain conditions for fusion on its own. A new reactor called the W7-X at the Max Planck Institute may be able to generate a usable amount of power once it is switched on. Or it may turn out that we still have a long way to go before we can harness the power of the stars.