This long-tongued creature, whose name means "filth licker", appeared in the first volume of Toriyama Sekien's famous Gazu Hyakki Yakō
While Sekien left no explanation, it is likely he based his creation on the aka-neburi
(垢ねぶり) (also meaning "filth-licker"), a creature from the Edo Period story collection called Kokon Hyaku Monogatari Hyōban
(古今百物語評判), which lives in public baths and dilapidated houses.2
Today the akaname is often explained as a creature which appears in bathrooms where cleaning has been neglected and filth has accumulated for it to lick, but this explanation seems to have originated in the Yōkai Gadan Zenshū, a monster anthology published in the 1920's by Fujisawa Morihiko.
1. Toriyama, p. 20
2. Fujisawa Morihiko to Toriyama Sekien - Akaname