It looks like English -ing. It doesn't act like it.
Every regular Spanish gerund follows one of two patterns, and the pattern depends only on which conjugation the verb belongs to. First-conjugation verbs (-ar) add -ando: hablar becomes hablando, estudiar becomes estudiando. Second- and third-conjugation verbs (-er and -ir) both add -iendo: comer becomes comiendo, vivir becomes viviendo. Nothing about meaning or usage frequency decides which ending a verb takes, only its infinitive ending does, and that holds for every verb in the language before irregularities get involved.
What trips up English speakers isn't the formation, it's the assumption that a Spanish gerund behaves like an English one. The RAE's own reference grammar, El buen uso del español, is explicit that the gerund "usually functions as a verb and, as such, admits a subject, whether explicit or implicit," and can take direct, indirect, and other verbal complements just like a conjugated verb would (leyéndolo, "reading it"; hablándole, "speaking to him/her"). English -ing forms slide between verb and noun depending on the sentence: "reading" is a verb in "I am reading" and a noun in "reading is relaxing." Spanish never lets the gerund make that second jump, which is the single most consequential difference covered further down this page.
Two irregular patterns, and why they exist
The first irregular pattern belongs to stem-changing -ir verbs: pedir becomes pidiendo, sentir becomes sintiendo, decir becomes diciendo, venir becomes viniendo, and the vowel shift is e→i in every case. A second, smaller o→u group covers dormir (durmiendo) and morir (muriendo), plus poder (pudiendo), the one -er verb that borrows this -ir-style shift. That shift traces back to a shared cause: pidió and pidiendo, durmió and durmiendo, pull from the same altered stem the third-person preterite uses for these same verbs, so the two forms line up for a structural reason rather than by coincidence.
The second pattern covers verbs whose stem ends in a vowel: leer (leyendo), oír (oyendo), traer (trayendo), caer (cayendo), construir (construyendo), huir (huyendo), and ir (yendo). Spanish doesn't tolerate two vowels landing side by side where -iendo would otherwise attach directly to a vowel-final stem, le-iendo or ca-iendo, so the unstressed i between two vowels turns into a y instead, giving leyendo and cayendo. The underlying ending stays -iendo the whole time; only the spelling adjusts to keep the sounds distinct.
What the gerund is actually for
The gerund's single most common job is building progressive tenses with estar: estoy comiendo (I am eating), estaba lloviendo (it was raining). Ser vs. estar covers why estar, never ser, is the verb that pairs with a gerund this way; there are no exceptions to that rule anywhere in standard Spanish. Beyond estar, a handful of other verbs combine with the gerund for related but distinct meanings: seguir and continuar plus a gerund mean "to keep doing something" (sigue lloviendo, "it's still raining"), llevar plus a time expression and a gerund expresses how long something has been going on (llevo dos años estudiando español, "I've been studying Spanish for two years"), and ir plus a gerund can frame an action as gradual or incremental (va mejorando, "it's gradually improving").
Outside those verb-plus-gerund constructions, the gerund also stands alone as an adverbial modifier describing how or under what circumstances something happens: se acercó arrastrándose (he approached, dragging himself along) or salió corriendo (she left running, i.e., she ran out). There's also a perfect gerund, habiendo plus a past participle, for an action completed before another one: habiendo terminado el examen, salió del aula (having finished the exam, she left the classroom). All of these keep the gerund doing verb-like work, describing an action or a manner, never standing in as the name of a thing.
The mistake: treating it like an English noun
English lets an -ing form serve as a subject ("swimming is fun"), an object ("I love reading"), or the object of a preposition ("thanks for coming"). Spanish blocks all three. The infinitive fills that role instead, every time: swimming is fun is nadar es divertido, not nadando es divertido; I love reading is me encanta leer, not me encanta leyendo. There is no context in standard Spanish where a bare gerund can occupy the subject or object slot of a sentence the way English -ing does. Reaching for the gerund there is one of the most common and most immediately noticeable errors an English speaker makes in Spanish, precisely because the same -ing habit that's correct in English gets carried over whole.
What the RAE flags as wrong, even though people write it anyway
Two specific gerund patterns get singled out by the RAE's stylebooks as incorrect, independent of the noun-versus-verb issue above, because native speakers do produce them, mostly in journalism and legal or administrative writing. The first is the gerundio de posterioridad: using a gerund to describe an action that happens after the main verb, with no real causal or near-simultaneous link between the two. The RAE's own guidance states plainly that a gerund shouldn't mark a pure temporal succession, giving Estudió en Madrid, yendo después a Buenos Aires as an incorrect example; the fix is a separate clause, estudió en Madrid y fue después a Buenos Aires. The rule loosens when the gap between the two actions is close to zero (lo empujó haciéndolo caer, "he pushed him, making him fall") or when there's a real cause-and-effect or concessive relationship, but a gerund used purely to bolt on "and then" is flagged as non-standard.
The second is the gerundio especificativo: using a gerund the way English uses an adjective clause, to identify or narrow down which noun is being talked about, as in a hypothetical una caja conteniendo joyas ("a box containing jewels"). Spanish reserves that job for a relative clause instead, una caja que contenía joyas. The RAE's stylebook for legal writing calls this pattern the "gerundio del BOE," after how often it turns up in Spain's official gazette, and treats it as an error to avoid outside of two narrow exceptions: a small set of gerunds that have fully lexicalized into adjectives (agua hirviendo, "boiling water"; clavo ardiendo, "burning nail") and gerunds attached specifically to nouns about a piece of information, like carta or mensaje (una carta solicitando ayuda, "a letter requesting help"), where the gerund describes the content of that message rather than picking the noun out of a group.