Tribalism is a vestige from when humans were in small groups, and encountering another group could potentially mean death. The tribe that walked over smiling and carrying gifts got slaughtered, and those doing the slaughtering were our ancestors. Evolution selected for tribalism.
The term tribalism brings about thoughts of warring barbaric tribes fighting over land or resources. In our time, when it's relatively easy to make sure your basic needs are met, it's ideas which differentiate us and thereby activate our tendency towards tribalism.
Differentiation comes out of a human tendency to categorize. In areas where characteristics are easily identifiable (i.e. race, gender, nose size, hair texture) this differentiation allows humans to group people into separate and distinct human groups.
Tribalism doesn't just extend to physical differentiation. It encompasses our entire lives: religion, political ideologies, familial affiliation, race, gender, employer, social groups. This occurs to such a degree that humans often identify themselves through their affiliations.
Tribalism is also a trait that marketers are well aware of, and use to sell you things. Lifestyle branding has exploded recently - Apple isn't just selling you a computer, and Starbucks isn't just selling you a cup of coffee. It represents inclusion into a group and signaling to other members of that group that you belong.
Tribalism has proven beneficial to humans, otherwise the trait would not have survived. It allows for complex relationships to form outside of just familial bonding or sexual hierarchies. It allows humans to organize as companies, communities, and nations.
Tribalism also represents the worst of humanity. It allowed for genocides such as the Holocaust, and Rwanda. It enables racism and sexism to survive and still divide humanity into useless groups. It allows for political environments to fragment so badly they refuse to pass new legislation.
There is no cure for this: Just as the cell gives us life, it also gives us cancer. Tribalism gives us group cohesion, but it also gives us fragmentation.