While in use since the early 1880s as a national anthem on a de facto basis, and the words to the anthem are from the tenth century or earlier, making "Kimigayo" the oldest national anthem in that sense, the government only officially adopted the anthem in 1999.
The government presented its interpretation of the meaning of the anthem "Kimigayo" in the Diet during the deliberation of a bill to codify the country's national flag and anthem. At the plenary session of the House of Representatives of the Diet held on June 29, 1999, Prime Minister Obuchi explained as follows: "Kimi in 'Kimigayo', under the current Constitution of Japan, indicates the Emperor, who is the symbol of the State and of the unity of the people, deriving his position from the will of the people with whom resides sovereign power; 'Kimigayo' as a whole depicts the state of being of our country, which has the Emperor–deriving his position from the will of the people with whom resides sovereign power– as the symbol of itself and of the unity of the people; and it is appropriate to interpret the words of the anthem as praying for the lasting prosperity and peace of our country."
It is not known who first wrote the words of the anthem. They first appeared in the Kokinshu, a collection "of ancient and modern poems" dating from the tenth century. From very early times, the poem was recited to commemorate auspicious occasions and at banquets celebrating important events. The words were often put to music and were also used in fairy tales and other stories and even appeared in the Edo-period popular fiction known as ukiyo-zoshi and in collections of humorous kyoka (mad verse).
When the Meiji period began in 1868 and Japan made its start as a modern nation, there was not yet anything called a "national anthem." In 1869 the British military band instructor John William Fenton, who was then working in Yokohama, learned that Japan lacked a national anthem and told the members of Japan's military band about the British national anthem "God Save the King." Fenton emphasized the necessity of a national anthem and proposed that he would compose the music if someone would provide the words. The band members requested Artillery Captain Oyama Iwao, who was well versed in Japanese and Chinese history and literature, to select appropriate words for such an anthem. Fenton put his own music to the "Kimigayo" words selected by Oyama, and the first "Kimigayo" anthem was the result. The melody was, however, completely different from the one known today. It was performed, with the accompaniment of brass instruments, during an army parade in 1870, but it was later considered to be lacking in solemnity, and it was agreed that a revision was needed.
In 1876, Osamu Yusuke, the director of the Naval Band, submitted to the Navy Ministry a proposal for changing the music, and on the basis of his proposal it was decided that the new melody should reflect the style used in musical chants performed at the imperial court. In July 1880, four persons were named to a committee to revise the music. They were Naval Band director Nakamura Yusuke; Army Band director Yotsumoto Yoshitoyo; the court director of gagaku (Japanese court music) performances, Hayashi Hiromori; and a German instructor under contract with the navy, Franz Eckert. Finally a melody produced by Hiromori Hayashi was selected on the basis of the traditional scale used in gagaku. Eckert made a four-part vocal arrangement, and the new national anthem was first performed in the imperial palace on the Meiji Emperor's birthday, November 3, 1880. This was the beginning of the "Kimigayo" national anthem we know today. (nationalanthems.info)
The postcard above features the musical score of Japan's national anthem, Kimigayo