Animals of all types defend their territories.
Man is so much more than an animal now though. So, its a tough question.
As a concept I am neutral towards it. Its implementation is something I tend to evaluate on an individual basis.
Nationalism is just a political tool, whether it is good or bad depends on whether the constitutional ideals and government of the nation in question are necessary/good, or better off being overthrown and replaced. I'm am not nationalistic towards my home country America, but I would be if I agreed with everything it stood for.
Do I feel some sentiment towards the land I live on, the people I live with, the culture I live in? Sure I do, but those concepts aren't restricted by territorial boundaries agreed upon by states and enforced by violence. And I definitely don't have positive sentiment towards the US government, the nation state I live under.
There is a recent tendency for voters in advanced countries to vote for isolationism, and to use the idea of Nationalism to defend it. Why might this be?
If we decide to be ignorant and take the definition that the populace and the media give of nationalism, describing it as pride in the state itself and patriotic symbols over those of other states (something that by definition is not nationalism but constitutional patriotism) , and in this case a huge number of western countries could be classified as nationalists. However, if we take nationalism as a desire for permanence and self-sufficiency of the nation itself, as well as a claim for the right of a nationality to the reaffirmation of its own personality and collective identity through political self-determination, then we speak at the same time of the identitarian movements in struggle for the rights of black people and white nationalists and separatist in the United States, or of European fascisms at the same time of modern Latin American socialist movements, and of an endless number of movements and ideologies in contradiction or congruence among themselves that cannot be cataloged with the rapidity with which most of the population catalogs nationalisms, given their absolute ignorance of the depth of the sociopolitical panorama of the world in which they are living.
Nationalism cannot be understood as radical patriotism in the same way that libertarianism cannot be understood as the idea of giving benefits to the wealthy or socialism as the idea of increasing taxes and public benefits.
If someone wants to talk about a topic, the least they should do is find out a minimum information of this topic in particular, with a simple google search it is enough, but everyone prefers to drop the first thing that comes to their mind rather than stop to investigate and elucidate what they say.
Interestingly, Hayek himself argued in favor of private currencies as an alternative to national currencies for the same reason he argued in favor of national currencies as opposed to a global one. So Hayek was certainly not seeing states (not the same thing as nations, though we often speak of nation-states) as the only vector of competition, possibly he was seeing the fact there are diverging interest groups in an economy as a stimulus to competition. But the economy has to have these groups be inter-connected, possibly through trade or through transfer of capital.
For example, one of the reasons America has a strong economy is because it not only exports, and exports alot, but because Americans often "buy American". Same thing with Germany and China. But these geographic regions are abstract, the only thing binding them internally is a military that protects its currency, especially in the case of America and China. In reality, you could have different US states and Chinese provinces competing against each other (and in reality, this is what happens, for example, take the case of capital being transferred from the "rust belt" to Silicon Valley - an example of inter-regional economic competition within the same country). But you simply don't have a currency to reflect this competition. So we don't always have a very clear picture of who benefits more from globalism and who benefits more from nationalism. We simply have things like GDP, which means little since it reflects the sum total of a country's economic output - not which parts of a country are doing most of the output.
I suppose my point here is that, while I agree that competition between nation-states can be a good thing to stimulate competition, it's only one factor among many others that stimulate competition, and that it is hard to tell how impactful it is as such.
Economists should be forced to live in their utopias.