Einstein discovered that all forms of energy have an effective mass – ie they weigh something.
Sound energy has mass, heat energy has mass, and so on.
Consequently, particles of light, or photons, do have an effective mass.
However, it all comes from their motion and they have no intrinsic, or ‘rest’ mass, as you or I do.
This has to do with the fact that light sets the cosmic speed limit.
As Einstein first recognised, no material object can ever catch up to a beam of light.
Einstein discovered that as you push a body faster, more and more of the energy you put in manifests itself as mass.
Moving things get more massive and by a factor – the Lorentz factor – which depends on the ratio of the speed of the body to that of light.
You would need an infinite amount of energy to push a material body to the speed of light, so the speed of light is forever unreachable.
The exception is if the object has no rest mass to start with. Multiplying zero by any factor equals zero.
So photons – and any other particles with zero rest mass – can travel at the speed of light.
Ultimately, we have no idea why there is a speed limit set by the speed of light and why, for instance, we don’t live in a Universe where things can travel at infinite speed.