Including our own sun, stars are hot balls of glowing plasma held together by their own gravity, which is very intense. Stars are always crushing themselves inward, and the gravitational friction of this causes their interiors to heat up. Though it's a mere 5,800 Kelvin at its surface, a star can be 15 million Kelvin, which is very hot, at its core.
The intense pressure and temperature at a star’s core allows nuclear fusion reactions to happen. This is where, through several stages, atoms of hydrogen are combined into helium atoms. This reaction releases an enormous amount of energy in the form of gamma rays, which are trapped inside the star. They push outward against the gravitational contraction of the star. That’s the reason why stars hold to a certain size, and don’t continue contracting.
The gamma rays jump around in the star looking for ways to get out. They’re absorbed by an atom, and then emitted again. This can happen many times a second, and a single photon can take 100,000 years to get from the core of the star to its surface.