The story
From homework + folder (“a virtual container in a computer's file system, in which files and other subfolders may be stored”), from the notion that a folder containing pornography would be hidden by disguising it under a generic false name. Unrelated to homework (“sexual intercourse”) (slang, euphemistic).
Etymology from Wiktionary, CC BY-SA 4.0.