The process in which the sun releases energy is through a process called nuclear fusion. In it’s core hydrogen atoms fuse into helium atoms, (this of course is hard because 2 protons repel each other and for this to happen it requires a certain amount of energy and velocity when they collide,this is only possible because of the gravitational pressure at it’s core). In the process of fusion a little bit of mass which gets converted into energy.