Japan has been populated for at least 30,000 years. Most people assume immigration flowed from Asia's mainland to Japan in ancient times, but relics such as the magatama
were found earlier in Japan than Korea, suggesting two-way migration. By Kofun period, Chinese and Korean immigration to Japan was common and many immigrant clans claimed to be decedents of Chinese royalty (see: http://en.wikipedia.org/wiki/Hata_tribe
). We're not sure if they were pretenders or whatever, but from historical perspective, when a kingdom is lost, the former royalty often fled to a friendly neighbor. Being better educated and technologically advanced, the Chinese and Koreans back then would've enjoyed higher socio-economic status even as refugees, with valuable skills such as silk weaving and government administration.
The dominate ethnicity in Japan today is the Yamato. In early Tang-China period, the Yamato were still battling against the Emishi for dominance of Japan. Eventually the Emishi would be wiped out or assimilated. Few other cultures in the outer islands survived through Japan's expansion and conquest, i.e. Ainu, Ryukyuans, Nivkhs, Ulta, etc. Miyazaki's Mononoke-hime
's characters are based fictional isolated Emishi village boy & the expanding Yamato people.