The lack of matter between the sun and the earth prevents heat transfer by convection or conduction, leaving radiation as the only means of transferring heat to the earth.
Without molecules, heat can not transfer through conduction. With no gases or liquids, it can't transfer through convection. The only option left is radiation.
The Sun is a Massive Celestial body and several times massive than the Earth. It's like a giant Nuclear Reactor that burns copious amounts of Hydrogen which serves as it's basic fuel in fusion reactions that combine Hydrogen atoms to form Helium atoms. The temperature on the Sun's surface is about 6000 degrees Centigrade, whereas at it's heart it radiates a temperature of about one million degrees Celsius. Sun is a star that is close enough to Earth, which is situated in a zone called the Goldilocks zone, being neither too hot nor too cold to sustain life. It provides us with enough heat and light to neither leave us frozen not to burn us to cinders.
There's nothing in space to let Heat go by Convection and Conduction.