Heat can travel by conduction, which needs direct contact between particles, by convection, which needs a moving fluid, or by radiation, which travels as electromagnetic waves and needs no medium at all. The space between the sun and the earth is essentially empty, so there is nothing for conduction or convection to use to transfer heat. The only way solar heat can cross this gap is by radiating through it as electromagnetic waves, which is why sunlight's heat is called radiant heat.