Jingzhi Tan answers
In natural situations, an ape may interact with a stranger as it encounters a neighbor at the boundary of its territory or as an immigrant is trying to integrate into the social group. Being nice to strangers could have benefits like reducing the chance of inbreeding or establishing new friendship. However, it also comes at a cost. Social life is expensive because your companions are also your competitors. The intensity of feeding competition could therefore be a very important factor to explain xenophobia/xenophilia.
Chimpanzees and bonobos live at two sides of the Congo river and their habitats never overlap. Chimpanzees live in the north where they share the habitats with gorillas, while bonobos in the south do not face similar competition. This difference might drive the feeding competition among chimpanzees to a relatively higher level than bonobos. Chimpanzees are in general hostile to immigrants and are sometimes seeking to kill neighbors to expand territory. On the other hand, the constraint on social life might be more relaxed in bonobos so that they become less aggressive toward others and more willing to accept newcomers into their social networks.
Jingzhi Tan is a doctoral candidate in the department of evolutionary anthropology at Duke University.