Behavioral ecologists have long been comfortable assuming that genetic architecture does not constrain which phenotypescan evolve (the “phenotypic gambit”). For flexible behavioral traits, however, solutions to adaptive problems are reached not only by genetic evolution but also by behavioral changes within an individual’s lifetime, via psychological mechanisms such as learning. Standard optimality approaches ignore these mechanisms, implicitly assuming that they do not constrain the expression of adaptive behavior. This assumption, which we dub the behavioral gambit, is sometimes wrong: evolved psychological mechanisms can prevent animals from behaving optimally in specific situations. To understand the functional basis of behavior, we would do better by considering the underlying mechanisms, rather than the behavioral outcomes they produce, as the target of selection. This change of focus yields new, testable predictions about evolutionary equilibria, the development of behavior, and the properties of cognitive systems. Studies on the evolution of learning rules hint at the potential insights to be gained, but such mechanism-based approaches are underexploited. We highlight three future research priorities: (1) systematic theoretical analysis of the evolutionary properties of learning rules; (2) detailed empirical study of how animals learn in nonforaging contexts;and (3) analysis of individual differences in learning rules and their associated fitness consequences.