The Voyager spacecraft are travelling at about 36,000 mph, so are they actually travelling in a straight line or are they kind of just travelling in an orbit around the Sun while moving out because they're not going at the escape velocity?
All spacecraft that we send to other planets travel along a curved path, not a straight line. The idea is that you have an initial rocket boost that puts it in an elliptical orbit around the Sun, so that it will intersect with the planet you're sending it to. That's the most fuel-efficient way to do it.
In the case of Voyager 2 (which visited all four of the gas giant planets), the spacecraft was first put into an orbit that intersected with Jupiter. Once there, it was able to use Jupiter's gravity to slingshot into an orbit that intersected with Saturn. Then it slingshotted to Uranus, and then to Neptune. At Neptune, it was able to slingshot into what's called a "hyperbolic orbit". That means that it's moving along a trajectory that is only slightly curved (almost a straight line) away from the solar system. Because it left Neptune at a speed greater than the escape velocity of the Sun (at that distance), it will continue to move away from the solar system forever.
This page was last updated on January 13, 2016.