Sueño (Spanish for “dream”) and insomnia come from the same root: the Latin somnus, meaning, “sleep.”
The evolution is easy to spot if we remember that the -mn- sound in Latin usually transformed into the ñ in Spanish. See damn and daño, for example. Or autumn and otoño as well.
Thus, the s-mn of insomnia maps to the s-ñ of, sueño.
Daño, Spanish for “damage”, comes from the Latin for the same: damnum. From the same root we get both the English condemn and damn. But what happened to that missing ‘m’?
Interestingly, the Latin m-n sound tended to turn into a ñ sound in Spanish. This explains how autumn became otoño, for example.
We can still see this pattern preserved in the perfect mapping of d-ñ in daño to the d-mn of damn, and the same with condemn.
From the same root we also get the English indemnity, as well as damage itself, although the final -n was lost because damage entered English via French.
We can see the parallel but between daño, condemn, damage, and damnum — but how did it come to mean the formerly-vulgar, damn? Think of damn in the old sense of, sentencing someone for a crime they did: you are condemned to hell. A whole slew of English insults come from this same concept, including the word hell itself!
Otoño doesn’t sound much like its English translation, fall (the season). But if we think of the less common synonym, Autumn, then the pattern becomes a bit clearer.
Both come from the Latin for the same, Autumnus. But Latin words with an m-n sound usually became an ñ sound in Spanish. Think of damn and daño, for example. So the a-t-m-n of autumn maps to the o-t-ñ of otoño!