Imagine you're on a swing. The rope keeps you from flying away, but it also lets you go around in circles. Planets are like that, the sun's gravity acts like the rope of the swing, pulling them in and keeping them moving in a circle instead of flying off into space or crashing down.