Silent Night, "Stille Nacht," was first performed on Christmas Eve 1818 at St Nicholas parish church in Oberndorf, a village in Austria. A young Catholic priest, Father Joseph Mohr, had come to the village the year before. In the aftermath of the Napoleonic Wars, he had written the poem "Stille Nacht" in 1816.
The melody was composed by Franz Xaver Gruber, a nearby schoolmaster and organist. On Christmas Eve 1818, Mohr brought the words to Gruber and asked him to compose a melody and guitar accompaniment for that night's service, after river flooding had damaged the church organ.
It is unknown what inspired Mohr to write the lyrics, or what prompted him to create a new carol, though there are thoughts that he wanted a simple song to celebrate the holiday.
According to Gruber, Karl Mauracher, an organ builder who serviced the instrument at the Oberndorf church, was enamoured of the song and took the composition home with him. From there, two travelling families of folk singers, the Strassers and the Rainers, included the tune in their shows. The Rainers were already singing it around Christmas 1819, and once performed it for an audience that included Franz I of Austria and Alexander I of Russia, as well as making the first performance of the song in the U.S., in New York City in 1839.
By the 1840s the song was well known. During this period, the melody changed slightly to become the version that we recognize today.
Over the years, because the original manuscript was lost, Mohr's name was forgotten and although Gruber was known to be the composer, many people assumed the melody was composed by a famous composer, such as Haydn, Mozart, or Beethoven. However, a manuscript was discovered in 1995 in Mohr's handwriting and dated by researchers as c. 1820. It states that Mohr wrote the words in 1816 and shows that Gruber composed the music in 1818.
There are various renditions on YouTube. These may interest you.