The story
From the cave in the story Aladdin where the titular protagonist is trapped but ends up finding a genie and riches.
First known use, by meaning
- from 19th c. a place full of valuable or unusual objects
Etymology from Wiktionary, CC BY-SA 4.0.