Slingshot Effect

Slingshot or gravity assist

Let us suppose that we threw a perfectly elastic ball towards a moving train. And suppose that the mass of the train is very heavy. The mass of the ball 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 off at the speed of '2U + V'. (Of course, the speed does not come out because of the loss of energy in reality, but theoretically it is.)
In this case, the ball gets some kinetic energy from the train, and the speed is faster.
Conversely, if you throw a ball towards a train that is moving away, the speed of the ball after collision is further reduced.
The phenomenon of bringing or losing kinetic energy from such a larger counterpart is called the 'sling shot effect' or 'swing by'.
One example of a sling shot effect is that when you hit a baseball with a bat, you get high speeds.
It is the same principle that a spacecraft uses the gravity of a big planet to get faster speeds and is called 'gravity assist'.