I am not sure which one of the following sentences is more appropriate when I want to ask a person whether she is coming back from the gym. If none, please suggest a few.
1. Have you been to the gym?
2. Were you in the gym?
3. Did you go to the gym?
Exactly! If the gym is in the building or on the campus where you're asking the question, it's "in the gym."
Likewise, if you're talking about a larger place that includes a gym, like a school, you'd say "in the gym":
Were you in the cafeteria when you saw her, or were you in the gym?
But if the gym is simply somewhere else, it's "at the gym":
I spent the morning in the park and the afternoon at the gym.
I am still a bit confused with the 'have been' sentence, because I have seen people using it in sentences where they really mean 'have you ever been to...'1. Have you been to the gym?
Have you been to the kitchen (here)
Have you been to New York.
However, in my sentence I was just asking her where she was a while ago.
Sam: You look as if you just worked out. Have you been to the gym?If time is in focus (e.g., awhile ago), then use the simple past:
Pat: Yes. I had a great workout, thanks.
Sue: Where were you awhile ago? Did you go to the gym?
Pat: Yes. I was at the gym.