mystery (n.1) Look up mystery at Dictionary.com
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.
mystery (n.2) Look up mystery at Dictionary.com
"handicraft, trade, art" (archaic), late 14c., from Medieval Latin misterium, alteration of Latin ministerium "service, occupation, office, ministry" (see ministry), influenced in form by Medieval Latin mysterium (see mystery (n.1)) and in sense by maistrie "mastery." Now only in mystery play, in reference to the medieval performances, which often were staged by members of craft guilds. The two senses of mystery formed a common pun in (secular) Tudor theater.