I've been thinking of how so many myths and folktales revolve around the forbidden, around the mystery that is supposed to stay a mystery. In these stories, the protagonist's curiosity always overwhelms her (it is usually a woman, for some reason). She decides she has to know the mystery; she has to enter the forbidden territory. She does, usually to disastrous consequences. Think of Pandora opening her box, of Psyche shining the lamp on Cupid, of Bluebeard's wife unlocking his mystery room. And yet, as readers, we would not have it any other way. We simply cannot have a story in which the box remains closed, the mysterious husband remains masked, the locked room is undisturbed. We must know what's inside.
This came home to me recently when I caught part of an old movie that my husband was watching: Kiss Me Deadly. The movie includes a mysterious suitcase, and in the movie's final scenes, the person who ends up with the case is warned not to open it. Although I have plenty of scientific bones to pick over how things unfold in the film, the ending is inevitable from a literary point of view.
The mysterious box or room doesn't always have to lead to disaster, however. One book I read as a child, Look Through My Window (Jean Little), featured a mysterious locked box that turned out to have something wonderful inside. There are also locked boxes that reveal historical truths or magic spells.
Chekhov famously observed that a gun mentioned in the beginning of a story has to go off later in the story. Similarly, I'll assert that a locked box present at the beginning of a story must be opened by the end. The locked box certainly ramps up tension and keeps readers reading ... just make sure you know what's in the box!