Abstract Hunger, a state of nutrient deficiency, significantly enhances cognitive behaviors by heightening sensitivity to food‐related stimuli. However, the mechanisms by which hunger influences olfactory learning remain unclear. In this study, it is shown that aversive or appetitive memory is formed faster in hungry C. elegans . These findings reveal that hunger‐induced octopamine release from the interneuron RIC enhances both aversive and appetitive olfactory learning. By analyzing neural circuits downstream of RIC, two distinct pathways involved in memory formation are identified. For aversive learning, the sensory neuron ASH is activated via the SER‐3 receptor, leading to glutamate release, which acts on the GLR‐2 receptor in AIA interneuron during the starvation phase. During the training section, AIA is subsequently inhibited via the glutamate‐gated chloride channel GLC‐3 . In contrast, octopamine targets AIY interneurons through the SER‐6 receptor, promoting appetitive learning. Furthermore, it is indicated that norepinephrine, the mammalian homolog of octopamine, and alpha1‐adrenergic receptors may be involved in hunger‐enhanced olfactory learning in mice. These findings may offer insights into the neural mechanisms that underlie cognitive flexibility in response to physiological states.