Nearly twenty years ago I belonged to a gym. I don’t think it was right for me. I was told to rest between exercises. However, I think I took this a little too literally as I would actually fall asleep. This experience came to mind recently when I heard an interview with the author Eric Chaline. His book, The Temple of Perfection: A History of the Gym, has recently been published and it sounds well worth reading.

The gym as an institution goes back to ancient Greece and it encompasses nearly three millennia of history. There were some similarities with the modern gym, but there were also important differences. What we would recognise is the desire to attain an idealised body type. Our obsession with the body beautiful is not an invention of marketing types. Another similarity is that the Greeks recognised the value of rhythm in physical training they had music piped into in their gyms. Musicians were employed to play the flute to keep times for the athletes as they were training. I have to say that it sounds more appealing than the stuff that blares out in gyms today.

However, there were important differences. Ancient Athenian gyms were open-air spaces with no fixed equipment. Training in the Greek gym involved the practice of running long-jump, discus, and javelin – basically track and field disciplines. This was an important part of military training. It was an all-male environment where the athletes used to train in the nude and they were hotbeds of gay sex.

The gymnasium was an important social institution in the Classical period of Greek history. Most Greek gymnasia had libraries that could be utilized after relaxing in the baths. There was no formal school system, so the gym provided for the education in academic subjects and athletics for boys from the age of seven to fourteen. Girls were, of course, excluded. They were also like universities. The two most famous public gymnasia were Plato’s Academy and Aristotle’s Lyceum. This idea of combining physical and intellectual education for young men is retained in Holland, Albania and Germany. In these and many other countries gymnasiums are a kind of secondary school.

The decline of classical Greek civilisation lead to the gym falling out of favour for many centuries. Christianity saw the body as sinful and same-sex relationships as sodomy and so fourth-century Christians banned gyms. They did not re-emerge until the early nineteenth century. And once again military questions were important. At the battle of Jena the Prussian army was crushed by Napoleon. That their professional army could be defeated by a conscript French force was perceived as a national humiliation. To remedy this Friedrich Ludwig Jahn, a Prussian schoolmaster opened the first Turnplatz, an open-air gymnasium in the Berlin suburb of Hasenheide. As well as the ancient Greek sports, running and discus and javelin, etc, he incorporated equipment of his own design such as the parallel bars, the vaulting horse, and the high bar. These form the basis of the sport of modern gymnastics. The ethos at Jahn’s gymnasium was collective; he wanted turn the Prussians into soldiers who would be able to avenge Prussia’s humiliating defeat. Jahn is a controversial figure. As a German nationalist, he believed in maintaining German language and culture against foreign influence. In 1810 he wrote, “Poles, French, priests, aristocrats and Jews are Germany’s misfortune.” He may have had unsavoury views , but I think it is going a bit too far to call him the spiritual founder of Nazism, as was claimed by Peter Viereck who said that Jahn inspired the early German romantics with anti-Semitic and authoritarian doctrines, which then influenced Wagner and finally the Nazis.

Our story moves on to Brussels and Paris where Frenchman Hippolyte Triat founded the first commercial gymnasia. This fitness entrepreneur had originally been a vaudeville strongman. His gyms sound incredible. They were vast cathedral-like covered spaces built in cast iron and glass. There was an enormous exercise area with spectator galleries on the second and third floors. Patrons could participate in group calisthenics, jog, do weight training or use the strength machines.

The idea was taken on by another entrepreneurial strongman, Eugen Sandow. Born Friedrich Wilhelm Müller, he was a Prussian bodybuilder known as the father of modern bodybuilding. In 1896 he opened the Institute of Physical Culture in St James’s. Situated in an area where most of London’s gentlemen’s clubs would have been, Sandow’s club seemed to be trying to recreate their atmosphere. The palatial building boasted a luxury wood-panelled décor, smoking rooms, billiard rooms and Turkish baths. Persian rugs marked each exercise station. But it was, nevertheless, a gym. Sandow was one of the first to introduce progressive weight training with free weights, barbells and dumbbells. He was appealing to the aspirational middle classes: come and join a sort of gentlemen’s club and get fit at the same time.

In the 20th century the USA became the world’s superpower. Chaline points to certain parallels between modern American and ancient Greece. Both cultures share an individualistic and competitive ethos. The American gym became a place frequented by hyper-muscular supermen. This goal was facilitated by the invention of anabolic steroids. The hyper-muscular bodies now de rigueur in bodybuilding contests were simply not possible in the pre-steroids era.

Jane Fonda led another revolution in the1980s. Aerobics brought women into the gym. There was also a significant change in the type of equipment available and exercises that patrons could choose. Cardio equipment like bikes and treadmills became fixtures in the gym. Gym design had been built around the sweat of the bodybuilder, now gyms have become like hotels and fancy restaurants.

The economics of this are a little strange. Joining a gym is a form of what behavioural economists call pre-commitment. We convince ourselves that by putting down the money upfront we will make ourselves go to the gym. But it doesn’t work out that way.

The American chain of gyms, Planet Fitness, has, on average, 6,500 members per gym, even though most of its gyms can only hold around 300 people. If you are not going to the gym, you are actually the gym’s best customer. So gyms try to attract people who won’t come. Gyms know this and do what they can to attract people who haven’t traditionally been gym rats. In the end people who don’t go are subsidizing the membership of people who do.