He has several reasons to sabre-rattle like this.
1. He maintains power and justifies the totalitarian regime by creating the atmosphere of siege, the world is against North Korea, they're ready to wipe it off the map. He has to confront the world belligerently, thus, to justify to the people the need for his regime and its tight controls.
2. North Korea benefits from the threats to other nations, at least under Obama and Clinton, because it led to North Korea getting money and aid to STOP developing weapons or stop threatening the West's allies like South Korea.
3. North Korea until recently received aid and support from China, since China used it as an angry dog to viciously threaten its neighbors and the West. Again, a benefit for North Korea to be the bully on behalf of its benefactor.
4. North Korea's regime remains in power, too, by developing horrific weapons. No one will want to invade and take them out if it results in manufactured plague in Japan and nukes in South Korea. Thus the good offense is a great defense.