One core reason why is that people form their identity as part of the community they belong to.

They make competitive comparisons between their community and that of others, invariably in a way that favors their own. They go out of their way to exaggerate differences.