Selection of behavioral responses to external stimuli is strongly influenced by internal states, such as intentions and expectations. These internal states are often attributed to higher-order brain functions. Yet here we show that even in the simple feeding network of Aplysia, external stimuli do not directly specify which motor output is expressed; instead, the motor output is specified by the state of the network at the moment of stimulation. The history-dependence of this network state manifests itself in the same way as do intentions and expectations in the behavior of higher animals. Remarkably, we find that activity-dependent plasticity of a synapse within the network itself, rather than some higher-order network, mediates one important aspect of the change in the network state. Through this mechanism, changes in the network state become an automatic consequence of the generation of behavior. Altogether, our findings suggest that intentions and expectations may emerge within behavior-generating networks themselves from the plasticity of the very processes that generate the behavior.