While reward-oriented learning can adapt and optimize behavior, this chapter shows how behavior can become anticipatory and selectively goal-oriented. Flexibility and adaptability are necessary when living in changing environmental niches. As a consequence, different locations in the environment need to be distinguished to enable selective and optimally attuned interactions. To accomplish this, sensorimotor learning is necessary. With sufficient sensorimotor knowledge, the progressively abstract learning of environmental predictive models becomes possible. These models enable forward anticipations about action consequences and incoming sensory information. As a consequence, our own influences on the environment can be distinguished from other influences, following the re-afference principle. Moreover, inverse anticipations enable the selection of the behavior that is believed to reach current goals most effectively. Coupled with motivations, goal-directed behavior can be generated self-motivatedly. Furthermore, curious, information seeking, epistemic behavior can be generated. The remainder of the book addresses how the brain accomplishes this goal-oriented, self-motivated generation of behavior and thought, where the latter can be considered mental behavior.