Processes inside the sun release a lot of energy and radiative energy loss is a slow process, so the heat built up over time and raised temperatures. There is a lot of kinetic energy in the mass which makes up the body. Only three ways to get rid of it: convert it back into some sort of potential energy (nuclear binding energy; which is not possible given conditions), lose it by contact and direct emission of mass (the contact part is not possible given the lack of mass in space, and emissions, while important from our viewpoint, are tiny relative to the mass of the body) and by radiation. Radiation rates are a function of temperature, so the sun is radiating EM radiation at a steady-state rate that keeps temperature from increasing unless there are major process changes within the body. That is, the amount of energy being emitted as "radiation" is equal to the amount of energy being released by the internal processes of the star itself.