Today, in Japan, Buddhism and Shinto coexist peacefully. This has not always been the case historically. In the Asuka and Meiji periods, there existed significant friction between the two. Let’s save the discussion of Shinto in the Meiji period for another time. In the Asuka period (538–710), there were three significant clans influencing the monarchy: the Mononobe, the Soga, and the Nakatomi. In the sixth century (traditionally 538), a delegation sent to Japan from the king of Baekje (on the Korean peninsula) introduced Buddhism. This created tension between the new faith and the old faith. Before Buddhism’s arrival, the old faith didn’t even have a name. It became known as Shinto to differentiate it from Buddhism. I must also mention that Shinto was not a centralized and uniform religion at this time and, indeed, there were variations depending on location. At court, the Mononobe and Nakatomi clans supported Shinto and vehemently opposed Buddhism. The Soga strongly supported Buddhism. In this conflict over religion, Buddhism became triumphant, with the Soga clan crushing the Mononobe and Nakatomi clans and assassinating Emperor Sushun in 592.
At the end of the sixth century, Prince Shotoku became regent for his aunt Empress Suiko, who came to power after Emperor Sushun was assassinated. Prince Shotoku was one of the most significant figures in ancient Japanese history. He promoted Buddhism and was responsible for the establishment of temples such as Horyu-ji. Today, Horyu-ji is most notable for the fact that several of its buildings are the oldest surviving free-standing wooden structures on the planet. Prince Shotoku was interested in Chinese culture but saw the Japanese Monarchy as equal to that of China. This was reflected in the tone of Japanese missions to China in the seventh century.
“From the sovereign of the land of the rising sun to the sovereign of the land of the setting sun”
The above quote shows that the nascent Japanese state was unwilling to submit to China as an overlord (which is what many other Asian states did). The seventh century was the reunification of China under the Sui (and then the Tang) and the unification of the Korean peninsula under the Kingdom of Silla, there was pressure in Japan to increase the power of the central government so that Japan would be able to fend off attacks from continental powers.
Under Prince Shotoku, the Japanese state adopted a court ranking system based on the Chinese model. The court ranks had names such as virtue, benevolence, and propriety. Confucianism was a strong influence of Prince Shotoku and this can be seen in his famous Seventeen-Article Constitution (604). This constitution was not a western-style codified legal framework. Rather it emphasized virtues. From Confucianism, the constitution emphasized the importance of social harmony and cooperation. From Buddhism, the constitution emphasized self-understanding and inherent value of sentient beings (reverence for “the three treasures: the Buddha, the dharma, and the clergy 
 Varley, Paul. Japanese Culture: A Short History. p. 15
 First part of the Seventeen-Article Constitution.
 Japanese Philosophy: A Sourcebook. p.36.