Two main explanations, intraspecific niche divergence and sexual selection, have been proposed to explain the origin of sexual size dimorphism. To test these competing hypothesis I studied the ecology, feeding behavior, and diet of the lizard Anolis polylepis in a Costa Rican rain forest. Male A. polylepis were significantly larger and heavier than females but ate smaller food items and had lower stomach volumes, despite possessing longer and wider heads. Males were more sedentary than females or juveniles, chose higher perches, and were more likely to be involved in agonistic interactions. Diets of males, females, and juveniles were also significantly different taxonomically. These data are consistent with the sexual selection origin theory but not with an ecological one. Thus, observed dietary differences probably evolved once dimorphism had been attained through sexual selection.