How did egalitarianism emerge in early human societies? In contrast to dominance hierarchies in non-human primates, human simple forager bands are typically egalitarian, with male hunters often serving as the collective alpha. Here we present a thermodynamics-inspired simple population model, based on stochastic optimization of dominance relationships, in which a dominance hierarchy of individuals with exclusively self-centered characteristics (the desire to dominate, resentment at being dominated) transitions spontaneously to egalitarianism as their capacity for language develops. Language, specifically gossip, allows resentment against being dominated to promote the formation of antidominance coalitions which destabilize the alpha position for individuals, leading to a phase transition in which a coalition of the full population suddenly becomes dominant. Thus, egalitarianism emerges suddenly as the optimal powersharing arrangement in a population of selfish individuals without any inherently altruistic qualities. We speculate that egalitarianism driven by punishment for exhibiting alpha-like behavior may then set the stage for genuinely altruistic traits to propagate as predicted by game theory models. Based on model simulations, we also predict that egalitarianism is a pre-condition for adaptation of tools as weapons. Potential implications for origins of human moral belief systems are discussed.