The story
The noun is derived from moth + ball. The verb is derived from the noun.
Etymology from Wiktionary, CC BY-SA 4.0.
Today it means: A small ball of chemical pesticide (originally camphor and now typically naphthalene or paradichlorobenzene) and deodorant placed in or around clothing and other articles to deter moth larvae which may damage them. Full definition →
The noun is derived from moth + ball. The verb is derived from the noun.
Etymology from Wiktionary, CC BY-SA 4.0.