Slingshot effect
Suppose you throw an elastic ball to a moving train. And since the train's mass is huge, let's assume that the ball's mass is negligible compared to the mass of the train.
At this time, if the speed of the train is U and the speed of the ball is V, the ball hits the train and bounces at a speed of 2U + V. (Of course, in reality, the speed is not fully produced due to the loss of energy, but in theory it is.)
In this case, the ball takes some of the train's kinetic energy, so the speed is faster.
Conversely, if you throw the ball towards a train that is moving away, the ball's speed will decrease further after a collision.
This phenomenon of bringing or losing kinetic energy from a larger opponent is called the 'slingshot effect' or 'swing by.'
One example of the slingshot effect is that you can get high speed when hitting a baseball with a bat.
It is the same principle that a spacecraft uses a large planet's gravity to obtain a faster speed and is specifically called 'Gravity Assist.'