Habitual social interactions in nature can be explained in terms of evolutionary logic. Assume agent A interacts with agent B according to some behavioral pattern. This pattern is cooperative (mutually beneficial, symbiotic) if the fitness of A and B increase as a consequence of this behavior. It is selfish (parasitic, predatory) if the fitness of A increases and the fitness of B decreases. It is altruistic if the fitness of A decreases and the fitness of B increases, and it is spiteful if the fitness of A and B both decrease.
One interesting question is how can non-selfish behaviors evolve? Wouldn't selfish agents always drive other agents to extinction?
The social evolution lab formalizes the above concepts in NetLogo.
See Cooperation, Altruism, and Ethnocentrism in the sample models library under social sciences.
Predator-Prey relationships—the ultimate in selfishness—are explored in Predation.