This recent article by Amanda Mull makes an interesting argument about "Why Americans Really Go to the Gym." In it she argues that gyms aren't just about being healthy and looking beautiful. Part of the satisfaction of working out in a collective space is that, among other things, you get to be around people with similar values and you get to prove to others that you are someone with enough self-discipline to stay consistently active. In her words, "proving something to others is often a big part of proving it to yourself, and that's difficult to do when no one else can see you." Depending on how you interpret this, it might lead you to believe that we're all looking for a bit of validation from others. But I think the other way to look at it is that spaces such as gyms and offices aren't just empty vessels where we come to do our necessary work. They are also social environments that serve some potentially important psychological functions.
The other thing Mull's article touches on is the evolution of physical activity:
In the past 70 years, physical activity in America has transformed from a necessity of daily life into an often-expensive leisure activity, retrofitted into the foundation of people’s identities. As a concept, fitness was a response to the flourishing, sidewalk-free postwar American suburbs and what the fitness pioneer Bonnie Prudden dubbed “the tyranny of the wheel”: Americans went from strollers to school buses to cars, stripping out much of the on-foot transportation that had long characterized life in cities or on farms. “In the ’50s and ’60s, the body became a problem, and exercise developed—it had to develop—because people realized that we were all going to die of heart attacks,” Shelly McKenzie, the author of Getting Physical: The Rise of Fitness Culture in America, told me.