Generally, a spacecraft is launched with huge rockets into a certain trajectory, or path, and it continues on that that path. Often the smaller rockets that are attached to the spacecraft are not large enough to change that initial push significantly.
Spacecraft traveling in one direction have a hard time turning around and going in another.
Sometimes a spacecraft can use the gravity of a planet or moon for an orbit or swingby and change its direction that way. Other than that, the course is not changed in large ways, just adjusted or corrected. If a course correction is needed, the spacecraft will fire small attitude rockets to change the direction it is pointing. After that, the main thruster can give the rocket a push in the new direction. In order to do this, the location and heading of the spacecraft must be known perfectly.