NB: "where are you from?" is a question your HR training should already explicitly tell people not to ask candidates. I'm not in HR or management and I still make sure to mention it to new hires before doing my first interview alongside them. National origin is a protected class. Even within the US , "where are you from?" can proxy for a protected class. Race, mostly, or possibly religion.
It's also a question that's very easy to ask in good faith while making small talk, which makes it noticeably dangerous.
Ugh, this is a classic example of skewed logic going way too far before the underlying truth can catch up.
I am in tech management (also a recovering attorney) who routinely conducts interviews, and it is perfectly acceptable to ask where someone is from in a professional setting.
The unacceptable part, as OP at least hints at, is using the response as a proxy for some other verboten criteria or perhaps to kickoff an overly intrusive line of questioning.
These behaviors are odious on their own and why HR should be explicit in training against antipatterns, not spreading meaningless FUD which miss the point and permit bad habits to foster elsewhere.
It’s really inane that modern software recruiting claims to focus on getting a proper picture of the whole candidate , yet untrained interviewers counterfeit the whole endeavor thinking they’re politically correct because they’re afraid to ask anything but the same broken whiteboard questions.
If you don't collect the data in the first place, you can't misuse it - and it's much easier to prove that you didn't misuse it, because all you have to show is that you never had the dangerous data in the first place. This is the same advice we give about handling PII in applications.
It's also a question that's very easy to ask in good faith while making small talk, which makes it noticeably dangerous.