Consider the example of the etymology of the phrase "10 gallon hat":
Cattle drivers and ranchers in Texas and the Southwest often crossed paths with Mexican vaqueros who sported braided hatbands—called “galóns” in Spanish—on their sombreros. A “10 galón” sombrero was a hat with a large enough crown that it could hold 10 hatbands, but American cowboys may have anglicized the word to “gallon” and started referring to their own sombrero-inspired headgear as “10-gallon hats.”
-- From history.com
The veracity of this particular etymology aside, there are words and phrases whose origin is a misunderstanding or mishearing of some original word or phrase -- foreign or otherwise. This mistake then sticks, and the misheard word becomes the dominant, standard word in daily usage.
Is there a linguistic term for words that originate this way, or for this specific process of word transformation?