The noun swerve means a sudden turn off your path. As a verb, it means to move off your original route, possibly to avoid a collision. You can swerve either toward something or away from it.
The word swerve can be traced to the Old English sweorfan, "to turn aside," which is precisely the modern sense. It was first used as a verb in the 13th century and as a noun in the 18th. Swerve refers to a sudden veering off, perhaps not as sharp as a turn, but more a bending of your path. Think of the trajectory as an arc or curve, and remember that swerve rhymes with curve.