During development, the nervous system generates neurons that serve highly specialized roles and, accordingly, possess unique functional attributes. The chemosensory BAG neurons of <i>C. elegans</i> are striking exemplars of this. BAGs sense the respiratory gas carbon dioxide (CO<sub>2</sub>) and, in a context-dependent manner, switch from mediating avoidance of CO<sub>2</sub> to supporting CO<sub>2</sub> attraction. To determine mechanisms that support the physiology and plasticity of BAG neurons, we used tandem ChIP-seq and cell targeted RNA-seq to identify gene targets of the transcription factor ETS-5, which is required for BAG development. A functional screen of ETS-5 targets revealed that NHR-6, the sole <i>C. elegans</i> NR4A-type nuclear receptor, is required for BAG-mediated avoidance of CO<sub>2</sub> and regulates expression of a subset of BAG-specific genes. Unlike <i>
ets-5</i> mutants, which are defective for both attraction to and avoidance of CO<sub>2</sub>, <i>
nhr-6</i> mutants are fully competent for attraction. These data indicate that the remarkable ability of BAGs to adaptively assign positive or negative valence to a chemosensory stimulus requires a gene-regulatory program supported by an evolutionarily conserved type of nuclear receptor. We suggest that NHR-6 might be an example of a developmental mechanism for modular encoding of functional plasticity in the nervous system.