The mass of a star was at some point a nebula, which collapsed into the star.
That collapse reduced the gravitational potential energy of the mass of that nebula, which through accelleration, friction, and pressure, was turned into heat energy.
That heated mass will emit black-body emissions, and so the gravitational energy is now being radiated as light.
That collapse reduced the gravitational potential energy of the mass of that nebula, which through accelleration, friction, and pressure, was turned into heat energy.
That heated mass will emit black-body emissions, and so the gravitational energy is now being radiated as light.