How natural diversity is maintained is an evolutionary puzzle. Genetic variation can be eroded by drift and directional selection but some polymorphisms persist for long time periods, implicating a role for balancing selection. Here, we investigate the maintenance of a chromosomal inversion polymorphism in the seaweed fly Coelopa frigida. Using experimental evolution and quantifying fitness, we show that the inversion underlies a life-history trade-off, whereby each haplotype has opposing effects on larval survival and adult reproduction. Numerical simulations confirm that such antagonistic pleiotropy can maintain polymorphism. Our results also highlight the importance of sex-specific effects, dominance and environmental heterogeneity, whose interaction enhances the maintenance of polymorphism through antagonistic pleiotropy. Overall, our findings directly demonstrate how overdominance and sexual antagonism can emerge from a life-history trade-off, inviting reconsideration of antagonistic pleiotropy as a key part of multi-headed balancing selection processes that enable the persistence of genetic variation.