Tea's history in Japan is deeply connected with Buddhism's journey from China in the mainland to the Japanese Archipelago. Monks who studied Buddhism in China, where tea was already embedded in the culture, brought back the seeds of the tea plant when they returned.
Now the details are fuzzy. Who was the first person to bring tea to Japan, and when exactly that happened, are the subject of debate. However, historians generally agree that the Japanese likely first encountered tea during their diplomatic missions to China during the mid-late 8th century, and the first tea seeds were brought back to Japan in the early 9th century.
Since it was brought over with the monks, tea was central to Japanese Buddhism. It was cultivated on a small scale on monastery grounds as part of Buddhist practice. Emperor Saga became the first Japanese ruler to fall in love with the beverage and sponsor its growth in nearby Uji. For the first time, tea was being grown outside of monasteries, but the scale was still small. Only monks and nobility were consuming tea, mostly for its purported medicinal qualities. Gradually, the beverage was introduced to the Samurai and merchant classes. However, it would still be many centuries before tea-making processes advanced to allow for the booming tea culture we enjoy today.