The nematode Caenorhabditis elegans navigates toward a preferred temperature setpoint (Ts) determined by long-term temperature exposure. During thermotaxis, the worm migrates down temperature gradients at temperatures above Ts (negative thermotaxis) and performs isothermal tracking near Ts. Under some conditions, the worm migrates up temperature gradients below Ts (positive thermotaxis). Here, we analyze positive and negative thermotaxis toward Ts to study the role of specific neurons that have been proposed to be involved in thermotaxis using genetic ablation, behavioral tracking, and calcium imaging. We find differences in the strategies for positive and negative thermotaxis. Negative thermotaxis is achieved through biasing the frequency of reorientation maneuvers (turns and reversal turns) and biasing the direction of reorientation maneuvers toward colder temperatures. Positive thermotaxis, in contrast, biases only the direction of reorientation maneuvers toward warmer temperatures. We find that the AFD thermosensory neuron drives both positive and negative thermotaxis. The AIY interneuron, which is postsynaptic to AFD, may mediate the switch from negative to positive thermotaxis below Ts. We propose that multiple thermotactic behaviors, each defined by a distinct set of sensorimotor transformations, emanate from the AFD thermosensory neurons. AFD learns and stores the memory of preferred temperatures, detects temperature gradients, and drives the appropriate thermotactic behavior in each temperature regime by the flexible use of downstream circuits.