Before I explain in details, we need to understand whether we are altruist by social education or as a result of evolutionary inheritance? Is altruism embedded in our genetics?
The word “altruism” (derived from French autre “other,” in its turn derived from Latin alter “other”) was coined by Auguste Comte, the French founder of positivism, in order to describe the ethical doctrine he supported. He believed that individuals had a moral obligation to serve the interest of others or the “greater good” of humanity. Comte says, in his Catechisme Positiviste,
social point of view cannot tolerate the notion of rights, for such notion rests on individualism. We are born under a load of obligations of every kind, to our predecessors, to our successors, to our contemporaries. After our birth these obligations increase or accumulate, for it is some time before we can return any service…. This [“to live for others”], the definitive formula of human morality, gives a direct sanction exclusively to our instincts of benevolence, the common source of happiness and duty. [Man must serve] Humanity, who we are entirely.
Although in all the religions, altruism is the foundation of their very existence, in biology definition is tricky and at a time uprightly rude. My action will be under the definition of biological altruism if it reduces my reproductive fitness while increasing the same for the benefactors .
For example during the freedom struggle of India, all the freedom fighters risked their life as well as survival of their family so that fellow Indians can live in freedom and prosperity. The same phenomena is also observed throughout the biological kingdom-birds guard the eggs of the other birds risking their lives. Question that scientists always tried to answer- why the species, or we the biological beings tend to sacrifice our own reproductive fitness when from Darwinism it appears, we are nothing but a genetic survival machine? How would you explain this anomaly ?
Biologists came up with two possible explanations. Darwin tried to explain this as group selection-that is survival of a genetic group is more important than individual genetic mark-ups. But Richard Dawkins explained such group genetic explanation has problem with ” subversion from within” .
Imagine that in a group of birds with altruistic genes, one mutant bird with a selfish gene is born. This selfish bird will be a “free rider” because it will have an advantage in reproductive fitness in virtue of the altruism of the other birds. Consequently, its selfish gene is more likely to be reproduced, and, over time, one would expect a selfish mutant gene to dominate over the altruistic gene. A counter to this model would be the consideration that if groups are benefited by altruism within the group, then a more altruistic group may well hold a selective advantage over a second group weakened by the individual with the selfish gene.
Therefore the second possibility is with kin selection and reciprocal altruism. This means, if I be altruist to your cause, you will be to mine as well- a simple game of favor exchange. Gandhism is based on reciprocal altruism. That is, if we be kind enough to our opponent and let them see through clearly that we are their friends and not foes and thus by doing so, if our opponents realize that our altruist behavior is to his benefit where as his oppressive nature is even against his own reproductive fitness, there is always a high possibility our enemy will turn altruist towards us as well.
Hamilton, W. D. 1970. “Selfish and Spiteful Behaviour in an Evolutionary Model,” Nature 228: 1218-1220.
Hamilton, W. D. 1972. “Altruism and Related Phenomena, mainly in the Social Insects,’ Annual Review of Ecology and Systematics 3: 193-232
 Maynard Smith, J., 1998. “The Origin of Altruism,” Nature 393: 639-640.
 Sober, E. 1988. “What is Evolutionary Altruism?” in New Essays on Philosophy and Biology (Canadian Journal of Philosophy Supp. Vol. 14), B. Linsky and M. Mathen, eds., Calgary: University of Calgary Press. )