Subjunctive spelling changes to preserve sound
When we conjugate verbs in the present subjunctive, the endings swap: -ar verbs take endings starting with e, while -er and -ir verbs take endings starting with a.
For some verbs, this vowel swap would change their pronunciation. To keep the original consonant sound of the infinitive, we change the spelling of the stem. These spelling changes happen in all forms (including nosotros and vosotros).
Verbs ending in -zar (z -> c)
In Spanish, the letter z is rarely followed by an e. To keep the same sound when adding the subjunctive -ar endings, verbs like alcanzar (to reach) and rechazar (to reject) change the z to a c (e.g., alcance, alcancemos).
Verbs ending in -gar (g -> gu)
If we just added an e to a verb like castigar (to punish), it would be spelled castige and pronounced with a raspy "h" sound. To keep the hard "g" sound, we change the g to gu (e.g., castigue, castiguemos).
Verbs ending in -car (c -> qu)
A c followed by an e makes a "th" or "s" sound. To keep the hard "k" sound of verbs like justificar (to justify) and criticar (to criticize), the c changes to qu (e.g., justifique, justifiquemos).
Verbs ending in -ger and -gir (g -> j)
For -er and -ir verbs, the subjunctive endings start with a. A g followed by an a makes a hard "g" sound. To keep the raspy "h" sound of verbs like dirigir (to manage) and fingir (to pretend), the g changes to a j (e.g., dirija, dirijamos).