The song enumerates gifts given on each of the Twelve Days of Christmas—the period from December 25 (Christmas) to January 5 (Twelfth Night).
Commemorates the Magi's visit to the infant Jesus. It is the day after the twelve days end. The song's timeline leads up to Epiphany Eve but does not reference the Magi, the star, or the theological event.
The song is likely a memory-and-forfeit game from 18th-century England, not a catechism tool (a modern myth). Its gifts are secular and cumulative.