The effect known as the gravity assist or slingshot effect is a way of using the motion of a planet to accelerate a space probe on its journey towards the outer planets.
Jupiter is not stationary! It is moving in its orbit around the Sun at about 48000 km/hr. As it space probe moves towards the planet it will accelerate as before but because Jupiter is moving it is “dragged along” by the planet, having its speed increased considerably by the planet's motion. Its speed after the encounter is much greater than it was before.
The gravity pull of the planet has given the space probe some additional energy. Of course the gravity pull of the space probe will have slowed down Jupiter but by only a tiny amount because the planet is so much more massive than the space probe.
The space probe will have had its speed in the direction of Jupiter’s motion increased greatly. It has gained energy from the planet.
To get the best gravity effect or slingshot it is vital to launch the space craft at the right time so that it gets the slingshot effect in the right direction, hurling it towards its destination rather than whipping it out away from the Solar System into deep space.
In this animation the white ball represents the satellite given the gravity assist and the pale blue ball represents one that is lauched towards the same distant planet but in a straight line - it does not gain any speed from a gravity assist.
(The size of the Earth and its distance from Jupiter are not to scale. The Earth is also made to remain stationary.)