Mothballs are small balls of chemical pesticide and deodorant used when storing clothing and other articles susceptible to damage from mold or moth larvae (especially clothes moths like Tineola bisselliella).
Their use when clothing is stored out-of-season gave rise to the colloquial usage of the terms mothballed and put into mothballs to refer to anything which is put into storage or whose operation is suspended.
Older mothballs consisted primarily of naphthalene, but due to naphthalene's flammability, modern mothballs use 1,4-dichlorobenzene instead. Both of these ingredients have a strong, pungent odor often associated strongly with mothballs. Camphor, an insect repellent, can be used in mothballs also.
The idea with both chemicals is to kill moths and moth larvae with the fumes. Both naphthalene and para-dichlorobenzene sublimate, meaning they transition from a solid straight to a gas. The gas is toxic to the moths.
For either of these chemicals to be effective, they need to be placed with the clothing in a sealed container so the fumes can build up and kill the moths. In a sealed atmosphere like this, the fumes are not harmful to people because they are contained. The main threat would occur when opening the containers, or from wearing clothes immediately after opening (especially a problem for infants). A solution is to open the containers outside and let the clothes hang and air out for a day before wearing.