For 99 percent of the past several hundred thousand years of hominid development, our brains were evolving in social settings consisting of small (ten to thirty), mostly kin groups of hunter-gatherers. One great benefit of this arrangement is that it fostered altruism: as E.O. Wilson argues persuasively (The Social Conquest of Earth, 2012), a selfish person will always out-compete an altruist, but a group of altruists will always out-compete a group of selfish people. Those groups that cooperated in the hunt and shared the roasted zebra around the campfire prospered, while those who fought over the spoils of the day were eliminated from the gene pool.
There is a downside, however, to the social milieu in which our brains evolved: outsiders were considered (and probably often were) the enemy, the other. This instilled an innate fear and loathing of the other in the more primitive parts of the brain. The prefrontal cortex can, of course, override this (now often irrational) fear, but it works slower and takes effort. Part of that effort we call education; unfortunately, not all of our institutions engaging in education today put this role front and center in what they do.