Espuma (Spanish for “foam”) is a (surprising) cousin of the English, scum.
Both come from the same Indo-European root skeu-, which meant, “to cover, hide.” In the Germanic side of Indo-European, this evolved into skuma — literally “foam” — which then evolved into scum.
Transition from the meaning of “foam” in the old Germanic to the current meaning happened because of the sense of “foam”: the layer above the liquid” turned into “a layer of dirt on top of something cleaner”. And that then evolved into just pure dirt. Words degrade over time, at least in English.
The Indo-European skeu- separately evolved into espuma (via the Latin spuma, also just meaning neutrally “foam”) which — still today — retains the more neutral connotation of just foam.