The story
From tree + hugger. Popularized after the Chipko movement in India of the 1970s, who resorted to actual group hugging of trees in order to prevent deforestation. Tommy James claims that his song "Draggin' the Line" (1971) popularized the phrase.
Etymology from Wiktionary, CC BY-SA 4.0.