The Sun's rays contain heat. It is the heat from the Sun that warms the ground, and the air touching the ground is warmed in turn.
The more overhead the Sun, the more directly the rays reach the Earth and the more concentrated they are.
The Sun is overhead every day near the Equator, which is why it is hotter than the poles. In our part of the world the Sun is highest in summer, but never overhead.