Another forgotten major contributor of the decline
There is still another issue that has also been a major contributor to the decline of communal showers that has somehow been overlooked on here and that is the introduction of indoor air conditioning.
Air conditioning was first invented in 1902 but it actually took several decades for it to become mainstream, back then it was a different system, it was very expensive and it would've only been a luxury to the very wealthy. In the 1950s window air conditioners were first introduced but they weren't the same as they are today, they were very limited and still quite pricy and not many people had them. Cars didn't even start offering A/C until the 1940s and even then it was only in a few luxury vehicles, most cars didn't start having it until the 1970s. Across the board central air conditioning didn't become the norm in homes until around the late 70s early 80s. Even most commercial and government buildings didn't have it. Even in the early 80s many schools across the US still didn't have A/C, especially schools up north, hence. . .schools being closed during the summer. Even to this day, A/C is still not the norm in Europe with most homes not even having it.
Back in the days before A/C was available, after gym class having to run laps and do push ups in a non air conditioned stuffy gym, most likely boys would've been dripping with sweat, thus, a nice cold refreshing shower would've been ideal. Back in say the 1950s and before, during the hot summer months, kids would have to think of ways to beat the heat, so it was pretty common for young boys to go take a nice cool skinny dip in the nearby creek or pond. Back in the day at men's college dorms, military barracks or even on naval ships, where there were no women present, it would still get pretty muggy during the warmer months and it would've been rare that most guys would've kept all their clothes on, most likely would've paraded around in their undies or in some cases would've just paraded around in their birthday suit. Most YMCAs and gyms likely wouldn't have had A/C until probably the late 70s, that being said, no one would want to leave the gym without a nice cold shower, in fact, during those hot summers, the local Y would've been a great place to go swim a few nude laps in the pool to cool off your body. Even still today in remote villages in Africa, India, Thailand, etc. it's still not uncommon for boys to go for a nice cool skinny dip in the nearby river.
All this being said, the introduction of A/C, sadly gave people more reason to keep all their clothes on but the pre A/C generation seems to have somehow been forgotten about.