Homo sapiens is a social species, like our closest relatives, the gorillas and chimpanzees. Members of social species are born with a few rules (instincts) programmed into their brains. You understand that an individual by himself will have a hard time surviving, so you instinctively care for and cooperate with the people you've lived with since birth.
That worked fine in the early stone age--the Paleolithic Era. But as we discovered agriculture and other technologies, the size of our communities grew, and before long we were living among people whom we didn't know very well--if at all. At this point in our social evolution (about 12,000 years ago) we had to develop artificial rules to keep the communities working smoothly. We understood that larger communities are more prosperous than small ones (division of labor and economies of scale, for instance, increase the productivity of every member and therefore of the whole tribe), so it seemed worth the trouble to learn to live by artificial rules.
Technology kept increasing the size of our communities, until the average member only knew a small percentage of the population personally. Today we live in nations with populations in the hundreds of millions, having to treat people we've never met, whose names we don't know, and who are essentially nothing more than abstractions to us, as members of our community.
This is not easy because it conflicts with our instincts. So we invent and enforce more and more rules to keep the peace. Most of the time it works, but not always. Religion, in particular, seems to be a tremendous force for suspicion, hatred and conflict. Religion as we know it was invented in the Bronze Age, and, if you ask me, it has no place in a modern society.