The phenomenon you're referring to is known as length contraction, or Lorentz contraction, and it is a consequence of Einstein's theory of special relativity. According to this theory, as an object moves faster and approaches the speed of light, it appears to contract in the direction of its motion as observed by an external observer. This effect occurs along the line of motion and does not imply that the object is physically shrinking.
Length contraction is a consequence of the relativity of simultaneity, time dilation, and the constant speed of light. When an object is in motion relative to an observer, the observer measures the time it takes for light to travel from the front to the back of the object to be longer than if the object were at rest. Since the speed of light is constant for all observers, this discrepancy in the time it takes for light to traverse the length of the object leads to the observed contraction.
To understand this, consider a thought experiment: Imagine a rod at rest relative to an observer. The observer measures the length of the rod to be its "proper length." Now, if the same observer sees the rod moving at a significant fraction of the speed of light, they would measure the length of the rod to be shorter than its proper length in the direction of motion.
The key to understanding this effect lies in the relativity of simultaneity. As an object moves faster, the synchrony of events happening at different positions along the object becomes distorted for an external observer. The front and back ends of the moving object are measured at different points in time, leading to the perceived contraction.
It's important to note that length contraction is only observed from the perspective of the external observer. For the object in motion, its own measurements of its length would remain unchanged. This phenomenon is reciprocal, meaning that observers in relative motion to each other would measure the other's length to be contracted.
In summary, as an object approaches the speed of light, it appears to contract in the direction of its motion due to the relativity of simultaneity and time dilation effects. This contraction is a consequence of how measurements of time and space are affected by relativistic motion, and it does not imply that the object is physically getting smaller.