Nationalism is the favouring of one's own nation over others, and so necessarily requires denying equitable distribution of resources throughout the world according to need.
Humanity started out as families and tribes of hunter-gatherers. Agriculture brought locational stability and the ability to live together in increasingly larger settlements, eventually leading to civilisations largely centred around a principal city. These waxed and waned as they fought wars and evolved.
The idea of nations only happened in the last few centuries, as empires and kingdoms gave way to much more locationally enduring senses of belonging and identity. The stability led to more regular government and laws, and relied less on the whims of a despot or monarch. Wars still occurred, and borders changed, but the various national identities and sentiments remained, but national identity began to dominate over ethnic identity, leading to multicultural societies in many nations.
Unfortunately, those who sought power would invoke their national identity to rally their citizens to war on their behalf, and while that often resulted in increasing the size of their nations, other nations surrounding them would be dominated, and there would be attempts to erase their own national identities to subsume their populations in the dominating national identity. In other wars, nations would lose and be dominated, land-wise and in identity, while also losing much of their wealth and status.
As with all civilisations and empires, dominating nations would eventually succumb to their own decay, and dormant formerly-subsumed national identities would again take hold, enabling those nations to live again. If they had lost a lot of their wealth, they would be at a disadvantage to those nations that had retained or expanded their power and influence. Corporations from those powerful nations would exploit the workers and resources of those weaker nations, leading to further inequality and spur many people in the latter's administrations to become corrupt, just to survive.
One of the significant characteristics of highly nationalistic cultures is an excess amount of social conformity coercion, which can include suppression of non-allowed languages and customs, overtly patriotic propaganda, rewriting history or suppressing discussion of historic violence, and excess restrictions and imprisonment of minorities. This is what happened in Nazi Germany, Russia in its former satellite countries, Israel with Palestine, and the US and its minorities. This is the irony and tragedy of claiming freedom for nations but them not giving it to their peoples.
If we are to have a truly equitable world, the idea of national identity needs to be subsumed by our global identity. Then we can each choose to recognise our individual identities and what is best for our individual and communal benefit, rather than the manufactured national identities which have been transitory illusions harvested for power over us by those who seek to dominates us. Freed of false and exploited ideas of some amorphous national identity, we can be who we truly are, rather than what some would have us believe ourselves to be. That is true freedom, and worth striving for.