It's part of a strict school uniform policy... along with the white shirt & ties shown in the picture. Oddly, up until a little over 50 years ago, shorts were included or allowed in almost all school uniforms for boys during warm weather. Then many schools got air conditioning so they felt shorts were no longer required. But if schools don't have air conditioning, or are too cheap to turn it on, they can't imitate the uniform standards of more prestigious schools that use AC.
Also as schools have extended the school year past mid-June, & start their school year earlier, the shorts become more necessary. Even if the school does use AC there's the hot sticky walk or bus ride to get there & back. Most standard school buses do not have AC. Shorts do help a lot to cool down, although most adults wouldn't immediately notice it. Young kid's bodies may not have grown to adapt to extremes of heat & cold yet.
And just like adults, some can handle heat or cold better than others. I find most people of all ages that don't seem to mind spending some time or play outdoors when it's cold, really can't handle hot days. Where people who barely break a sweat on a real hot day, shiver when bundled up well on a mildly chilly day. It may be whatever climate they're used to the most, but genetics may play a role. It may depend on what kind of climate their ancestors were used to.
It's also odd that schools keep extending the school year more & more into the summer, increasing the daily school hours more, & increasing homework to increase test scores & performance. The schools & countries with the best test scores & performance, the kids have the least amount of school days per year, the least hours in school per day, & no or very little homework.
Think of it in from an adult's perspective. Many adults have to take some of their work home with them to spend some extra hours on it occasionally. But if most adults were stuck taking their work home with them to spend an extra hour or 2 on it every day & weekends, most would refuse or quit their job. Kid are full of energy. They need to play, interact, & have quality time. Forcing more school hours & more school work on them will lose their attention. All that extra time they load on the kid will just be wasted as the kid's mind starts to wander, daydream, get annoyed, or simply start to ignore it all. They'll get to dread & hate it instead.