Large and long-standing gaps exist in the gender composition of science, technology, engineering, and mathematics (STEM) fields. Abundant research has sought to explain these gaps, typically focusing on women, though these gaps result from the decisions of men as well as women. Here we study gender differences in STEM persistence with a focus on men’s choices, finding that men persist in these domains even where opting out could lead to greater material payoffs. Study 1 employed a novel experimental paradigm for measuring “overpersistence,” finding that undergraduate men chose mathematics questions over verbal questions at higher rates than undergraduate women on a test in which mathematics questions were substantially more difficult than verbal questions and participants were paid for correct answers. Study 2 analyzed data from a nationally representative longitudinal survey, finding that men are more likely than women to retake college STEM courses after failing them and that men’s STEM retaking after failure is as likely to lead to lower later life earnings as to higher earnings. Finally, in Study 3, we used a survey-embedded experiment to examine the intervening factors driving men’s overpersistence in a diverse sample of adults. Integrating prior theoretical work, we find evidence for a model in which cultural stereotypes of male superiority in mathematics lead men both to be more confident in and identify more with the mathematics domain, factors that in turn lead men to pursue math to a greater extent than women.