How did they become emperors? It's pretty simple: The Japanese royal family is directly descended from the Yamato Clan, who unified Japan for the first time about 1,500 years ago. That's how.
What's unique about Japan is that, unlike many other countries such as China, where one dynasty was repeatedly challenged and replaced by another through wars, the Yamato have been the only dynasty in Japanese history. This remained true even after the Shogunates (military rulers) took political power away from the Yamato clan, leaving them with only ceremonial and spiritual duties. The political and military rulers have changed many times in Japan, but the royal family survived mainly because they were content with their ceremonial and spiritual duties, not trying to regain political or military power.https://www.youtube.com/watch?v=9cbuv2GV1PM&t=1718s