To preserve its sovereignty, and preserve the inflow of foreign aid that the regime uses to prop itself up by preventing the starvation and likely resulting chaos that'd occur if forced to try to support its population from its own ill-managed resources.
I'm sure at least someone close to Kim knows that to actually nuke an American city would invite massive retaliation. But seeming plausibly crazy enough to do it anyway is a good way to make an otherwise absurdly insignificant little country seem like one that needs to be reckoned with. They're banking on the idea that the US will go far out of its way to avoid even the remote possibility of even a minor nuclear strike, and thus far it's worked out for them.
The Norks have also gotten a lot of mileage from their blackmail/bullying behavior over the years. They may be calculating other countries will be willing to make concessions to keep the crazy guy with nukes quiet.
- if they relax the control
- if some other country decide to "liberate" NK
They probably don't see any possible way out.