The Slingshot Effect (also known as Gravitational Assist) is a great way for a spacecraft to use a planet to gain or lose a great deal of velocity for free.
An example of the slingshot effect is a vehicle such as Voyager swinging behind Jupiter and gaining enough speed to make Saturn.
It's really much simpler than you would think- the effect is much the same as the way a ping pong ball goes so fast when hit by a bat; although in this case the spacecraft gets pulled by gravity rather than pushed.
Physicists refer to a body getting perturbed in this way as a collision, even though the craft never physically touches the planetary body; because the end results are very much the same.
OK, so the spacecraft ends up going much faster. But where does this speed come from? Well, Jupiter is moving, and the probe has used the gravity of Jupiter to grab hold of Jupiter and be towed along by it for a while; gaining from Jupiter's orbital speed. If you time it just right, and choose the angles you arrive and leave at, you can go swinging off with much greater speed.
Jupiter is minutely slowed by this encounter and it falls into a lower orbit about the Sun; but the amount of speed lost by Jupiter is immeasurably small because the probe is so much less massive than Jupiter.
Interestingly, relative to Jupiter the closing speed and departure speed is identical, albeit at different angles, but of course Jupiter itself is moving. So, from the Sun's point of view, the probe's speed has very much changed. (The same is true of the ping pong ball and the bat compared to the table, in fact, it's just the same thing.)
The slingshot effect can both increase as well as decrease speed, depending on whether the probe swings infront of or behind the planet.