Naphthalene is made from crude oil or coal tar. It is also produced when things burn, so naphthalene is found in cigarette smoke, car exhaust, and smoke from forest fires. It is used as an insecticide and pest repellent.
The labeled use of mothballs is to kill moths and other fiber insects to protect clothing. To do so properly, place mothballs inside tightly closed containers along with the clothing or materials. The vapors will remain inside the container and kill the moths.