On a long interplanetary voyage, a spacecraft can steal power from the planets. Instead of burning rocket fuel, it approaches a planet on a trajectory such that the planet’s gravity will change its course and speed it up or slow it down, as required.
ESA’s scientific spacecraft employ such manoeuvres. Giotto used the Earth in 1990 to re-aim itself at a second comet. Ulysses swung by Jupiter in 1992 to become the first spacecraft ever to route itself over the poles of the Sun.
To take the NASA-ESA Cassini-Huygens spacecraft to Saturn, or ESA’s Rosetta to Comet Wirtanen, requires multiple swingbys.