the sun's technically plasma but it emits light due to nuclear fusion (hydrogens smash together and turn into helium + a little bit of energy, and that little bit of energy adds up)
that energy gets converted into heat and light which makes its way from the core of the sun to its surface and escapes into space