Sakanoue no Mochiki was a real person. He was a famous waka poet. I was unable to find a painting of him, but the above picture is of his close relative, Sakanoue no Korenori, who was also a famous poet. Prior to the rise of waka poetry almost all Japanese poetry was written in Chinese. Waka poetry was written in Japanese. Both forms were popular throughout the Heian Period. Mochiki is also said to be the progenitor of the Kojima clan in Japan.
Sakanoue no Mochiki was appointed by Emperor Murakami as one of the Five Men of the Pear Chamber. These men were tasked with compiling the Gosen Wakashu, to this day regarded as one of the greatest works of Japanese poetry. Mochiki’s descendents became legal scholars and police officials. Not much is known about Mochiki himself, but the Five Men of the Pair Chamber were so named because they met in a room in the Imperial Palace that adjoined a garden with a beautiful pear tree. The Emperor lived nearby within the palace.
Poetry was highly valued in the Heian era, and because Emperor Murakami hand selected the Men of Pear Chamber, Mochiki and Murakami would have known each other and been in contact. The Accidental Samurai fictionalizes the depth of the friendship and political ties between Mochiki and Murakami, but it is possible such connections did exist.