Einstein's theory of special relativity indeed states that an object with mass cannot travel at or exceed the speed of light in a vacuum. According to this theory, as an object with mass approaches the speed of light, its energy and momentum increase, and it requires an infinite amount of energy to accelerate it to the speed of light. This is often referred to as the "mass-energy equivalence" principle, famously expressed by Einstein's equation E=mc², where E represents energy, m represents mass, and c represents the speed of light.
The notion that a massless object gains mass when it travels at the speed of light can be interpreted differently. In special relativity, the mass of an object is not considered a fixed and invariant quantity. Instead, it is described by the concept of relativistic mass, which increases with velocity. As an object with mass accelerates closer to the speed of light, its relativistic mass increases, and it requires more energy to continue accelerating.
However, the concept of relativistic mass is less commonly used in modern physics, and it has been largely replaced by the concept of invariant mass. The invariant mass of an object is the same regardless of its velocity, and it is considered a fundamental property of the object. In this framework, massless particles, such as photons (particles of light), have zero invariant mass and always travel at the speed of light.
The idea that a massless object gains mass when it travels at the speed of light is not considered a paradox within the framework of special relativity. It simply reflects the behavior of objects with different velocities and their associated energy and momentum. It is important to note that the concept of mass in relativity can be complex, and different interpretations exist depending on the context and the chosen framework of analysis.