late 14c., from Old French closet "small enclosure, private room," diminutive of clos "enclosure," from Latin clausum "closed space, enclosure, confinement," from neuter past participle of claudere "to shut" (see close (v.)). In Matt. vi:6 it renders Latin cubiculum "bedchamber, bedroom," Greek tamieion "chamber, inner chamber, secret room;" thus originally in English "a private room for study or prayer." Modern sense of "small side-room for storage" is first recorded 1610s.
The adjective is from 1680s, "private, secluded;" meaning "secret, unknown" recorded from 1952, first of alcoholism, but by 1970s used principally of homosexuality; the phrase come out of the closet "admit something openly" first recorded 1963, and lent new meanings to the word out.