Trees provide shade
Shade reduces temperature
More elaborate (and boring) explanation:
Plant canopies block shortwave (k) and longwave (l) radiation, reducing radiative exposure to solid surfaces. The plant canopy can also reduce air temperature by converting sensible heat into latent heat of vaporization. This is possible through the evapotranspiration process. Therefore, plant canopies are technically more effective than man-made shelters at reducing temperature.
Here’s a journal paper if you wanna get all sciencey and stuff: