early 14c., 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), from Latin mysterium "secret rite, secret worship; a secret thing," from Greek mysterion (usually in plural mysteria) "secret rite or doctrine," from mystes "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," is from late 14c. In reference to the ancient rites of Greece, Egypt, etc. it is attested from 1640s. Meaning "detective story" first recorded in English 1908.