SignificanceAnimals frequently show the same preference toward a chemosensory cue under widely varying external and internal conditions. Whether such chemosensory cues involve similar neural mechanisms across conditions is unclear. Here, we show that carbon dioxide (CO2) is processed through distinct neural mechanisms inC. elegansat two different life stages that show the same preference for CO2. These mechanistic differences are manifested in altered CO2-evoked neuronal activity and motor output. A life stage–specific change in neural connectivity and insulin signaling contribute to these circuit differences by modulating the functional properties of an interneuron. We demonstrate that distinct neural mechanisms may underlie the same preference for a chemosensory cue and highlight the importance of physiological context in understanding chemosensory behaviors.