The tune is much older than the words. It comes from Piae Cantiones, a collection of Latin songs printed in 1582, where it carries a spring carol, Tempus adest floridum, "the time of flowering is here". In 1853 the English hymn writer John Mason Neale wrote new words for it about Saint Wenceslas, and those are the words sung today.
Wenceslas was a real person: a 10th-century duke of Bohemia, honoured after his death as a saint and today the patron saint of the Czech Republic. He ruled as a duke, not a king. The carol is set on the Feast of Stephen, 26 December: the king sees a poor man gathering firewood in the snow and goes out with his page to bring him food and fuel, and the page, failing in the cold, walks in his master's footprints and finds them warm.
This transcription: Melody "Tempus adest floridum" from Piae Cantiones (1582), with John Mason Neale's words (1853), as sung today: in G major; left hand by GOONS Studio.
Transcribed by GOONS Studio from the original work, which is in the public domain.