On the sun it's nuclear energy. The sun gets so hot that fusion occurs; when atoms are joined together either from extreme heat or force. In the sun's case, both extreme force from the sun's raging gasses and and heat from the searing hydrogen and helium are contributing to the fusion process.
It's 'rays' are electromagnetic.