It's often argued that the act of physically going to the place is what makes you do it. Personally, I know that I probably get more use out of the static bike at my gym than most people get out of the Peloton collecting dust in their own home.
The path of least resistance also curves around working out within the confines of your own home. If you struggle going for a run or going to the gym, putting on the clothes and forcing yourself out of the door is 99% of the act.
There's a similar parallel with working from home. Sometimes the change of environment and the mood of that environment is what compels people to move between resting/exercising/working mode.
Of course, for the gym in particular, it does also depend on what the journey to the gym is like as well as other factors (weather, traffic etc.)