First appearing in Old English in the form antefn, anthem derives ultimately from Greek antiphōnos—a word meaning "responsive" that is a combination of anti-, meaning "over" or "against," and phōnē, "sound" or "voice." The Greek root gives a hint as to what the musical form of early anthems was like. Originally, anthems were devotional verses sung as a response during a religious service.
By the 16th century, anthems consisted of psalms, hymns, or prayers sung responsively by two separated choirs. Music for soloists and instrumental accompaniment (normally the organ) were eventually incorporated into the liturgical anthems and alternated with verses sung by a single choir. The name for such alternating or responsive singing is antiphony, and, fittingly, the base of that word—antiphon—became a synonym of anthem in Middle English.
Anthiphon is more than just a synonym of anthem, however—it is a doublet of the word, which means that it came into English by a different path and at a different time than anthem but from the same root word. Whereas anthem was developed from a Late Latin word based on Greek antiphōnos sometime before the 12th century, antiphon was borrowed from Middle French in the 15th century and that French word traces back to the Latin and Greek words that gave English anthem.
About the same time as the adoption of antiphon into the English language, anthem developed a more general sense outside of church referring to a song or hymn of praise or gladness.
Forthwith, an Anthem of ecstatick praise Broke from their lips.
— Joseph Beaumont, Psyche, 1648
By the 18th century, anthem transcended in meaning and became the name for any inspirational musical composition that serves to symbolize or identify a nation, a group, an individual, or a cause. Such a composition could be anything from a hymn or march to a fanfare expressing one's pride in belonging to a group. This sense of the word is most familiar in the term national anthem.
One of the first songs identified as a "national anthem" is Great Britain's "God Save the King," which was referred to as such in the early 1800s but was first performed in the 1740s. Interestingly, it has been noted that "God Save the King" is a hymn. It may be that hymnlike patriotic songs became known as "anthems" because they were typically sung chorally and on solemn occasions.
America’s national anthem, ”The Star-Spangled Banner," was penned by Francis Scott Key after watching the British attack Fort McHenry during the War of 1812 and seeing the American flag still flying high the next morning. The song gained popularity over the course of the 19th century and in 1931 it was officially adopted as the national anthem by Congress.