They might not be about that, but they do that. Why do I deserve good healthcare, food, housing and a great quality of life and someone born in Syria doesn't?
For the same reason your spouse "deserves" sitting on the couch you got at home eating something from the fridge and somebody you don't know outside doesn't, and you don't consider it much of a discrimination.
Because e.g. it's your house, you've built it (a nation is something people build, over centuries and generations, often with huge sacrifices, not something they merely rent), you've stocked it, you paid the taxes for it, etc. And you might, or might not, accept someone in it.
Why doesn't the same-nation homeless person outside "deserve" good healthcare, food, housing? Why not fix their situation before you solve that of "someone born in Syria"?
Probably because the latter just seems of no cost (just let them in), whereas the other one understands that involves some sacrifices (share income, increased taxes for social welfare, etc, etc).
And for a large (land-wise) nation state, like the US, with tons of recent 1-2-3 generation immigrants, many people tend to think it's inexhaustible and can accommodate everybody with no problem. And new/newish (1/2nd gen) immigrants now citizens wont understand whats the big claim of those whose ancestors built it over time, sacrifices to sustain it, etc anyway. After all they came there when it was already prospering. It's more like a hotel to them. This is quite more obvious in a more historical country with more homogenous population, which lived there and built it over many centuries or millennia.
And yet, one of the reasons the people several generations ago built it (the nation state), was to have a place of their own, where they live as they see fit (because they were persecuted in their own places), and be able to deny access to it to others outside -- and occasionally invite whoever they like, as long as they play with their rules/laws.
Also, notice how the direction is one way? Not many Americans want to go to Syria or Nigeria or Lagos or whatever. Seems people, ideologies, bad history, etc can screw up a nation state and its prospects, so they're not all interchangeable. That's part of what makes having a good nation state valuable, and wanting to maintain it that way (and not just make every country an open borders free-for-all).
You did not do anything to get that. But your parents, their parents and those who came before them did, with the intention that you would.
Folks in Tuvalu are going to lose the entirety of their geographical boundary to the sea.
I don't see why people should be kicked out of a country because they were born in another country. The whole concept of "illegal immigrant" just seems so ... medieval. Someone isn't allowed to live and work in a land because they were born across an imaginary line in the sand?
I don't get it
One good way to "get it" is to go try stay in their country, without following their due process to become a citizen, and see what happens.
A similar good way, is to go live in different countries for a while (try Syria too), and see what ideas some people have about running their countries, and consider whether you'd like people with such ideas to be a sizable minority or even majority in your country.
National borders are not about "discriminating against people for where they are born", anymore than your family house discriminates against people based on which family they were born into.
One would assume you don't just let anyone in your house, or feed everybody just like you do your children, or share your family assets with the whole neighborhood (even if it would be nice if you did, it, for one, would live less for you. Plus, not everybody is nice and altruistic, but most manage to be that towards their family).
People build a nation as a community, often fighting hard for it to exist (e.g. wars of independence), working hard to make it better, building it's culture, and so on. They have a right to want to preserve their preferred way of life, their culture, and the country/infrastructure/etc they have built (of course not everything is always harmonious inside a nation, the same way things are not all roses all the time inside a family. No human made thing is perfect - and no natural made thing, for that matter).
If nations did not exist, people should still have the right to invent them, that is, to create their own communities with people they share their living on a place, hardships and culture with, build their own thing, and protect it against people who don't share their values or haven't contributed to building them.
In fact nation states didn't exist in the far past, they are a development of enlightenment and modernity. We had empires, and feudal fiefdoms loyal to some remote king, and such before, and people literally struggled to break their pre-nation-state nations (ethnic, cultural and historical groups) free from them...