Can a rocket keep moving forever in outer space even if its no longer using fuel? Can a rocket use just enough fuel to reach an area wherein it has escaped a planet's gravitational pull and then turn its engine off?
Supposing there is nothing else with a gravitational pull that the rocket would get caught in, would the rocket keep on moving since there is nothing to slow it down?
 A: As pointed out in the comments, the rocket would continue at a constant velocity (given that gravity is nearly non-existent in the proximity of the rocket).  However, gravity is present everywhere in the universe.  Granted, in some areas of space you can find nearly flat spacetime, but would the rocket continue on forever at a constant velocity?  Probably not.  As the rocket continues on it journey it will at some future point interact with space-time that is more significantly curved (gravitation) and that will result in a change in the rocket's velocity.
A: If there is nothing else with a gravitational pull, then yes, it would go on forever.
However, this will not work in practice because the galaxy is full of "something else". You could leave Earth's orbit with a velocity of $11.186 km/s$ (that's Earth's escape velocity), but you cannot leave the Solar System, because the Solar System's escape velocity for a spacecraft launched from Earth is $16.6 km/s$. For a faster object, you could leave the Solar System, but the Milky Way's escape velocity is about $317 km/s$. Therefore your spacecraft will eventually turn around (i.e. accelerate).
A: If your question was, "would it keep moving if it doesn't encounter any gravitational field"
Yes it would.
A: Space is not empty. The gaps between the planets in our solar system are relatively empty, but once outside this cosmic carpet sweeper, there is interstellar matter that has mass.
Momentum would wash off, motion might continue but velocity would continually be reduced at a diminishing rate, over time. Forever is a long time.
