We study how individual components of a complex behavior, so‐called behavioral units, should be sequentially arranged when the overall goal is energy efficiency. We apply an optimization scheme to an existing probabilistic model of C. elegans chemical gradient navigation and find a family of solutions that share common properties. This family is used to analyze general principles of behavioral unit organization, which give rise to search strategies that match qualitatively with those observed in the animal. Specifically, the reorientation behavior emerging in energy efficient virtual worm searchers mimics the pirouette strategy observed in C. elegans, and the virtual worms dwell at the peak of the gradient. Our model predicts that pirouettes are in part associated with the inability to evaluate the gradient during a turn and that the animal does not act upon gradient information while reversing. Together, our results indicate that energy efficiency is an important factor in determining C. elegans gradient navigation. Our framework for the analysis of complex behaviors may, in the future, be used as part of an integrated approach to studying the neural basis of these behaviors.