I was in York last weekend and the word mystery came up quite a bit, since York is associated with mystery plays. However, I also visited the Merchant Adventurers' Hall in York, a medieval guild hall, and the word mystery was mentioned there too, but this time it meant 'job' or 'occupation'.
The Oxford English Dictionary has two separate entries for the word mystery. The first is the mystery play sense where mystery means mystical significance or religious truth, particularly one that is secret or that can only be known via divine revelation. Other definitions are a rite or sacrament of the Christian Church and an incident in the life of Christ. This latter sense is why the religious plays performed in York are called mystery plays. The current common meaning of mystery ie something inexplicable or enigmatic follows on from the theological meaning. Mystery also means - guess what - a young or inexperienced prostitute (I have mentioned several times before, eg here and here that there are a huge number of words in the Dictionary that can mean prostitute). Mystery in all these senses comes from the Latin mysterium, meaning 'secret'.
The second entry says that mystery meaning 'trade' or 'profession' and later 'guild' comes from the Latin misterium, with an i, not y, meaning 'duty' or 'service'. The OED says it is also possible that it was influenced by or confused with the word mastery.
By the way, the Adventurers in the hall's name above are 'those who adventured (ie risked) their money' in trading.