That is: a gym is a laboratory (workspace) for improving the physical condition and performance of your body.
That's not to say you can't make poor use of a gym (or a laboratory, for that matter). Or that all conditioning must occur at a gym (labs are complemented by fieldwork). But well-used, they're a vital adjunct to a fitness regimen.
That said: if it's possible to get there under your own power (walking, cycling), so much the better.
Just to put some numbers on this, walking 4mph (a mile every 15 mins) is unusually quick. Most people will work up a real sweat. A normal pace for many people is 17 minutes per mile.
If you walked 100 miles at 4mph, that comes to 1500 minutes or 25 hours.
25 hours/month walking is a sizable chunk of time. This is fantastic if you consider it time well spent.