There is a large literature on this. Dan Dennett and McKay have written a treatise in Brain and Behavioral Science that examines possible evolutionary rationales for mistaken beliefs, bizarre delusions, instances of self-deception, etc., they conclude that only positive illusions meet their criteria for being adaptive. Johnson and his colleagues have produced an evolutionary model suggesting that overconfidence maximizes individual fitness and that populations tend to become overconfident as long as benefits from contested resources are sufficiently large compared with the cost of competition.
Yamada et al. now look at resting state functional connectivity between brain regions whose activity correlates with the superiority illusion. Their abstract, and one figure from their paper:
The majority of individuals evaluate themselves as superior to average. This is a cognitive bias known as the “superiority illusion.” This illusion helps us to have hope for the future and is deep-rooted in the process of human evolution. In this study, we examined the default states of neural and molecular systems that generate this illusion, using resting-state functional MRI and PET. Resting-state functional connectivity between the frontal cortex and striatum regulated by inhibitory dopaminergic neurotransmission determines individual levels of the superiority illusion. Our findings help elucidate how this key aspect of the human mind is biologically determined, and identify potential molecular and neural targets for treatment for depressive realism.
Influence of striatal D2 availability on superiority illusion is mediated through dorsal anterior cingulate - striatal functional connectivity. Assuming an inverse relationship between D2 receptor availability and presynaptic dopamine release, dopamine likely acts on striatal D2 receptors to suppress functional connectivity between the dorsal striatum and dACC (2). This connectivity predicts individual differences in the superiority illusion The indirect effect of striatal D2 receptor availability on the superiority illusion is significantly mediated through dACC-striatal functional connectivity . “+” indicates a positive relationship; “–,” a negative relationship.