It's all about something called subject-auxiliary inversion.
In English the subject, which is normally a noun or noun phrase, precedes the verb. But when we form questions the positions are reversed. Consider your example:
(1) "Summer is hot".
(2) "Why is summer hot?"
In both examples, the noun "summer" is the subject and the verb is the auxiliary "is". In (1) the subject occurs before the verb as expected. But adding the non-subject question word "why" at the beginning in (2) triggers what we call subject-auxiliary inversion, where the subject and the auxiliary verb swap places (invert), so now the auxiliary verb "is" precedes the subject, i.e. the noun "summer".