I am European, and have been on the other side of this situation. I lived in India for several years, and spoke the language where I lived. So I wasn't really a tourist, but many people assumed I was, and thus treated me as such.
Of course, all foreigners in India get asked this a lot and very often as the first question when they meet new people.
To me, it's not really that it's rude, it's just that you get sort of tired of being asked it all the time. I remember joking with my friends that I should print out a small card with my nationality, age, marital status, education, etc. to hand around so that I wouldn't have to answer all the most common questions over and over when meeting people. Of course, that would actually have been rude, and I never seriously considered doing it.
Sometimes, though, as a joke, when people asked me where I was from, and I was tired of answering the question, I used to jokingly answer "Coimbatore" (another Indian city in the state I was living in). People would usually find that funny, sometimes it would confuse them a bit, and they would take a second look at my appearance. I would then give them the real answer.
So no, it's not really rude, it's a natural question to ask foreigners.
It just gets a bit tiring though. Of course, the most obvious thing about one is that one is a foreigner, and therefore it's a natural thing to ask. But sometimes, after having talked to hundreds of people, a part of one wishes conversations could start with something else. And that the most interesting thing about one wouldn't be that one is a foreigner.
However, I don't blame the locals for asking. Now that I am in my own native country again, I'm also tempted to ask most non-locals where they are from, simply out of curiosity. However, I try not to ask it initially. It usually comes up naturally later anyway, as a part of the conversation.
I hope this answer has explained something.
Recommendation for future encounters: It's fine to ask people where they are from, but consider waiting until you have talked a bit. (Maybe you already do wait, but I'm just mentioning it.) That might make people feel more relaxed, and they may feel happier answering the question. Moreover, it might even come up naturally during the course of conversation.