The idea behind a gravity assist is to use a planets gravity to accelerate a satellite. A satellite moving through the solar system will experience a force of attraction towards each planet as it draws near. As it approaches a planet it speeds up because of the attractive force of gravity. At the point of closest approach it will be travelling fastest, and as it starts to move away from the planet it slows down. If the planet were not also moving the net effect on the speed of the satellite would be zero (though the satellite would still change direction). The planet is moving however, and there is a difference in the relative speeds before and after the point of closest approach. The relative speed before closest approach is less than the relative speed after closest approach, so the time for which the force of gravity acts before the point of closest approach is less than after that point. This difference means that the satellite is speeded up more before the point of closest approach than it slows down after that point. The Cassini satellite, launched in October 1997 to observe Saturn, was repeatedly assisted by Venus, then in sequence, the Earth and Jupiter, before arriving eventually at Saturn.
The satellite gains kinetic energy and by following the correct trajectory (making course corrections if necessary), can be propelled anywhere in the solar system or even expelled from it. The kinetic energy gained by the satellite does not come from nowhere. The planet loses kinetic energy, but because the mass and kinetic energy of a planet is so large, this loss in kinetic energy is relatively trivial.
Unfortunately, for gravity assist to be possible the planets have be lined up so that the satellite can be 'assisted' from planet to planet, receiving another assist each time. The planets are onligned only periodically, so satellites using gravity assist to travel the solar system must be launched within certain time windows.