Felix Mendelssohn originally composed this melody as part of a cantata in 1840 to celebrate the invention of printing with movable type by Johannes Gutenberg. William H. Cummings adapted the melody in 1855 to fit a text by Charles Wesley that was first published in 1739 in the collection Hymns and Sacred Poems. The first line commonly used today, “Hark! The Herald Angels Sing” is an alteration by George Whitefield in his 1754 Collection of hymns for social worship.
See a list of other hymn and chorale themes here.