They have a business plan that is predicated on people signing up for a service that they want to use but don’t and fail to unsubscribe because it’s like giving up on reaching their perceived potential best selves. It’s simple.
The gyms could still offer online cancellation and continue to make bank from this behavior if they sold you a contract with a minimum term, and heavy cancellation fees if you try to cancel early.