Thermotaxis behavior of Caenorhabditis elegans is robust and highly plastic. A pair of sensory neurons, AFD, memorize environmental/cultivation temperature and communicate with a downstream neural circuit to adjust the temperature preference of the animal. This results in a behavioral bias where worms will move toward their cultivation temperature on a thermal gradient. Thermotaxis of C. elegans is also affected by the internal state and is temporarily abolished when worms are starved. Here I will discuss how C. elegans is able to modulate its behavior based on temperature by integrating environmental and internal information. Recent studies show that some parasitic nematodes have a similar thermosensory mechanism to C. elegans and exhibit cultivation-temperature-dependent thermotaxis. I will also discuss the common neural mechanisms that regulate thermosensation and thermotaxis in C. elegans and Strongyloides stercoralis.