Upon exposure to harmful microorganisms, hosts engage in protective molecular and behavioral immune responses, both of which are ultimately regulated by the nervous system. As discussed in Chapter 1 of this dissertation, the use of Caenorhabditis elegans bacterial infection models have allowed for many insights into the mechanisms of these immune responses, including some of the chemosensory neurons involved in the reduction of pathogen exposure via altering of behavior, or pathogen avoidance. However, key questions remain unanswered: how does intestinal infection lead to pathogen avoidance? What does the neural circuitry between chemosensory neurons that sense pathogenic bacterial cues and the motor neurons responsible for avoidance-associated locomotion look like? This dissertation attempts to answer these questions by using the genetic and computational tools available in C. elegans to probe the molecular pathways and neural circuits underlying pathogen avoidance.