Most gyms are over subscribed - if everyone who has a membership actually went to the gym they wouldn't have enough space/equipment for everyone. They would need to raise their rates to afford more. That is those who have a membership but don't go to the gym are subsidizing those who do go to the gym.
The more expensive gyms are not this way. They will let you cancel easily. They will often out of good customer service pause your membership if you don't visit at all for a month. However they cost twice as much and often have worn out equipment that a much cheaper gym would have replaced. As such if you really visit a gym one that makes canceling is hard.