Nationalism means devotion and loyalty to your nation’s interests above other nations. Islam means total brotherhood among its members, regardless of national boundaries. It expects that you portray virtues like generosity to other people even when they are of a different race, religion, nationality or tribe.
Ideally, Muslims would co-exist in one super-power Islamic state, living in unity bonded by Islamic teachings. Nationalism is a barrier that prevents Muslims across the world from achieving total unity. There is, however, nothing wrong when you are proud of your country. This is as long as you do not attach a form of superiority to it. Islam values respect for your parents, family, and neighbors above others. According to prophet Muhammad, you should tend for your close relatives before the rest of the world.
Your immediate community has more influence on you than the rest of the world; prioritizing it is, therefore, a natural human act. Quran 49:13 states that God created different gender, tribes, and races purely for identification. The verse further explains that superiority lies only in righteousness, not race or tribe. Prophet Muhammad, in his last sermon, explained that there is no such thing as a superior race. As long as you draw a line between superiority and pride in your country, nationalism is not un-Islamic.