Because preferir is a stem-changing verb.
In the present tense, the e in the stem changes to ie in most forms:
So prefiero is the correct I prefer form.
This kind of change is very common in Spanish. Other verbs like this include querer → quiero and pensar → pienso.
After a verb like preferir, Spanish often uses an infinitive to say what someone prefers to do.
So:
Quedarme is the infinitive quedarse with the reflexive pronoun me attached to the end.
This is normal after a conjugated verb:
You could also say me prefiero quedar in some structures with other verbs, but with a single infinitive like this, attaching the pronoun to the infinitive is the standard and natural choice.
Here, quedarse means to stay or to remain.
So quedarme en casa means to stay at home.
Be careful: quedar and quedarse can have several meanings depending on context. For example:
In this sentence, the meaning is clearly to stay.
Because the verb used for to stay in this sense is normally quedarse, not just quedar.
So:
If you said prefiero quedar en casa, that would sound wrong for this meaning.
In Spanish, en casa is a very common expression meaning at home.
So the sentence uses en casa because it means being at home in a general sense, not specifically inside a particular house as a physical building.
Compare:
Because this sentence is talking about a habitual or general situation:
Spanish uses the present tense after cuando when talking about things that happen regularly or generally.
If you are talking about a future event, Spanish often uses the present subjunctive after cuando:
So:
Yes, it is normal and recommended here.
The sentence begins with a subordinate clause:
In both Spanish and English, a comma is commonly used after an introductory clause like this.
So this punctuation is natural:
You may sometimes see commas omitted in informal writing, but the comma is the standard choice.
Yes, but the nuance is slightly different.
In many everyday situations, both are possible, but quedarme en casa is especially natural when the idea is not going out because of the heat.
Because calor is usually treated as an uncountable noun in this expression, like heat in English.
So Spanish says:
not normally:
You are talking about a lot of heat, not many heats.
Spanish sometimes does use plural nouns in other weather expressions, but calor in this common structure is singular.
Yes. Spanish allows some flexibility.
The original sentence is:
You could also say:
Both are correct. The difference is mainly one of emphasis and rhythm:
The original version sounds very natural and well-balanced.