Why fire is having colour ? And why sun is red if it produces white light?
The colour of “fire” is due to photons being emitted of energy levels equal to that of the energy released from electrons losing energy by dropping to a ‘lower orbit’ around an atom. The energy levels are specific to what is being burnt and the energy in the combustian. Different energy level photons have different wavelengths and hence different colours so fire can cover most widely known sections of the visible light spectrum as well as light wavelengths outside that.
However the sun, as pointed out in other answers, is not fire and is actually a collection of matter that forms from an original collapse under gravity to create pressure enough for nuclear fusion to occur. Our sun is a star of mass, stage and temperature (correlating to internal pressure) that emits lots of visible light via the same effect mentioned for fires visible-ness. Fire goes through an entirely different process to get here though. Some stars have much higher energy reactions and emit higher energy photons in wavelengths we can not see, as well as producing heavier elements like oxygen instead of the usual helium and hydrogen.
The sun is white plus many other colours we can not see, but we evolved to see these particular wavelengths as they were most useful to our survival. Other animals see light differently too like some crazy shrimps but this is due to natural selection in different environments.