Dashi told Omi when he gave him the second puzzle box that “the box will open when the person who needs to open it most opens it”. The first and second puzzle boxes are presumably identical, and Dashi’s lock actually explains perfectly why Wuya was trapped for so long: at any given time, there is only one person who will be able to open the box, making it nearly impossible statistically for Wuya to be released.
The mechanics of being chosen by the box as “the person who needs to open it most” are a bit complicated. I would think that they would go something like this:
- You have to willingly open the box; you cannot be possessed or be forced by a second party into trapping or releasing someone or something.
- To trap someone/something, you must actually have a real need for it to happen. No petty reasons; the fate of the world must be at stake [which is not all that uncommon on Xioalin Showdown]
- To release someone/something, you must be on the same side as whoever/whatever is in the box. A Xiaolin monk would not be able to free a Heylin witch, for example, but an evil boy genius or cat burglar would.
- Like Dashi said, you have to need to open the box most. You have to be at the end of your rope, stuck on the wrong path, or even simply benefit more than any other person: why you need it most could be anything and it’s the box that decides if you are or are not the person. This condition makes the person who can open the box change and difficult to determine who the person who needs it most is.
Dashi needed to open the box to trap Wuya and save the world from darkness. Jack Spicer needed to open the box to give him a push in the wrong direction for his evil plan of world conquest; no one else at the time on the Heylin side could have benefited from Wuya’s help more. Raimundo needed to open the box because he had realized his mistake and he had to save his friends and return to the Xiaolin side. Katnappe needed to open the box because she was the only one who knew about Shen Gong Wu’s existance who both wanted to find them and needed Wuya to locate them for her [Jack no longer needed Wuya the most because he was already in the game and had robots who could detect the Wu].
TL;DR The puzzle box can only be opened under certain conditions and by a single person. The person who needs it most can change and any time and is determined by the box. Because the people who needed to release Wuya the most never found her box throughout 1500 years, she remained trapped until the box was given to Jack Spicer, who happened to be the current person who needed it most.