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.
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. 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 when meeting people. Of course, that would have been even ruder, and I never seriously considered doing that.
Sometimes, 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 city in the same state I was in). People would usually find that funny, sometimes it would confuse them a bit, and they would take a second look at my appearance.
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 you is that you're a foreigner, and therefore it's a natural thing to ask. But sometimes, after having talked to hundreds of people, a part of you wishes conversations could start with something else. And that the most interesting thing about you isn't that you're a foreigner.
However, I don't blame the locals for asking. Now that I am in my native country again, I'm also tempted to ask most non-locals where they are from, simply from curiosity.
I hope this answer has explained something.
Recommendation for future encounters: It's fine to ask people where they are from, but wait until you have talked a bit. (Maybe you already did this.) That will make people feel more relaxed with you, and they may feel more happy to answer the question.