The scenario described relates to the Theory of Special Relativity. This theory, formulated by Albert Einstein in 1905, deals with the physics of objects moving at constant speeds, particularly at speeds close to the speed of light, and includes the concept of relative motion.
In the scenario, the boy perceives that he is not moving while on the train because he is in a non-accelerating (inertial) frame of reference. The other train traveling at the same speed and direction appears to be moving relative to him, but since both trains are moving at the same speed, the boy cannot perceive any motion relative to his own frame. This illustrates the principle of relativity, which states that the laws of physics are the same in all inertial frames of reference.
On the other hand, the General Theory of Relativity, which deals with gravity and acceleration, is not directly applicable to this particular scenario.