early 14c., misterie, in a theological sense, "religious truth via divine revelation, hidden spiritual significance, mystical truth," from Anglo-French *misterie, Old French mistere "secret, mystery, hidden meaning" (Modern French mystère) and directly from Latin mysterium "secret rite, secret worship; a sacrament, a secret thing."
This is from Greek mystērion (usually in plural mysteria) "secret rite or doctrine (known and practiced by certain initiated persons only), consisting of purifications, sacrificial offerings, processions, songs, etc.," from mystēs "one who has been initiated," from myein "to close, shut" (see mute (adj.)); perhaps referring to the lips (in secrecy) or to the eyes (only initiates were allowed to see the sacred rites).
The Greek word was used in Septuagint for "secret counsel of God," translated in Vulgate as sacramentum. Non-theological use in English, "a hidden or secret thing; a fact, matter, etc., of which the meaning explanation, or cause is unknown," is from late 14c. In reference to the ancient rites of Greece, Egypt, etc. it is attested from 1640s. Meaning "detective story" is recorded by 1908. Mystery meat, slang for "unidentifiable meat served in a military mess, student dining hall, etc." is by 1949, probably from World War II armed services.