Hugs, TC. Creepy. I think you did handle it very well and I'm glad your friend was there for you. Hopefully he gets the point and leaves you alone.
If he does show up at the gym again and just stands there staring, I'd go to one of the employees and tell them that guy is just standing there staring and if he's not a member perhaps he needs to be asked to leave.