The acceptable sequence is to initiate a social relationship, than find ways to find out if a romantic one is possible.
Skipping directly to sexual innuendo, as this guy has done, means exactly what you'd expect.
What you do next is up to you. If you want to disengage, there are many techniques, but the easiest/most direct ones might make the gym become an uncomfortable place for you, which is still a fail. So make a plan ...
Assuming you want to disengage:
Must do:
1. Do
not react positively to this person's stupid games. No "polite laughter", don't respond, don't continue the conversation(s), increase your average distance a little, no touching of any kind ever, etc.
2. Do
not make a big thing about it otherwise, except to execute a plan (see below). Removal of a false positive signal (i.e. (1)) is not the same as providing an actively negative signal (which is likely to induce a reaction).
May do:
Use indirectly negative signals (remember you're here because you don't want to nuke the relationship. Don't bother with this if you don't mind drama). Examples:
(a) Each time he does it, look directly at his eyes for a second or two "too long" with an absolutely neutral expression, then turn away and do something else.
(b) Say "please don't do that" in a neutral tone.
Under no circumstances react to a "what do you mean?" deflection or anything similar. You have no obligation to justify your comment, and you will "lose" any continued discussion because he will lie to your face.
(c) Say "Your comments make me uncomfortable".
Similarly to (b), do not defend or justify your statement.
FWIW, in similar cases I always add in the full "abrasive eye contact" version of (a), but if you don't already know how to do that, this is not a good situation in which to learn it.
Direct approach (nukes):
There are lots of options, but simple is always good ...
Tell him to cut out the innuendo. You're not interested in him and you'd prefer to be left alone.
If he keeps it up anyway, two or three more brief, polite, but very direct requests to be left alone, then you complain formally and forcefully to gym management.
Remember that in most countries all you have to do is tell them he's making you uncomfortable with obviously sexual comments and either he, the gym, or both can be reported to the police.
The gym will almost certainly back down. "We'll talk to him" isn't enough either: you need them to intervene, then come back to you and explain what they did. Afterwards, if they don't explicitly tell you they'll help instantly if it happens again, ask them for their plan if he repeats.
If they try to brush it off (not intervene, no plan for if he continues, etc) you have other choices to make, but FWIW the
gym would
deserve to be nuked.
In all cases, regardless of what you do, don't make threats of any kind, nor indicate possible future actions.
* Never signal your strike
* If you strike, do not pull your punch
Also FWIW apologies are worth nothing IRL. You might get one, but don't have it as an objective.
You want a change of behavior, and you want to train in peace, without looking of your shoulder because there's a known AH in the same location.