SHANGHAI—At a moment when Xi Jinping desperately craves stability, Northeast Asia is in turmoil.

The escalating nuclear crisis on the Korean Peninsula presents Mr. Xi with an acute challenge just weeks ahead of a Communist Party Congress expected to return him to power for another five-year term.

Kim Jong Un is playing him, as he does U.S....