I want to congratulate the author for getting out of his comfort zone to tackle a hard problem. But being able to make friends at a gym is not a universal experience.
I joined a gym partially to get fit and partially to meet people with similar fitness goals. Working out alone just feels sad. I tried to be friendly with people, would smile and say "hi," when I walked past someone. I would ask someone a non-confrontational question about their workout. In months of trying, maybe a handful of people who at least said anything back. Zero conversations. The rest either responded with a blank stare or pretended to not hear me at all. Nobody ever approached me or said hi first the whole time I was there, except sometimes the people behind the counter.
I'm socially deficient but not THAT awkward and have no problem talking to people in other situations. I'm not sure if it was the kind of gym I was at, or just the wrong time of day, or if people in the gym only want attention from those who won the genetic lottery. But I didn't have much success.
I'd highly suggest joining a Brazilian jiu jitsu gym. They tend to be filled with other computer nerds (although not only) and people are very friendly in a genuine way.
Different gyms do have different cultures and probably time of day matters too. Absolute worst is right after work it’s so packed and everyone’s still kind of stressed and looking to get done and head out on to the next chore