The night of January 5, the vigil or eve of Epiphany, is so called because it is the twelfth night from Christmas, if Christmas is counted as the first. (The Twelve Days are not calculated in the same way everywhere. In some places Christmas is counted making Epiphany the thirteenth day. In England it is particularly confusing because January 6 is Twelfth Day but January 5 is Twelfth Night.)
In England, Twelfth Night had long been a period of partying marking the end of the Christmas season. Masquerading was a common activity on Twelfth Night along with dancing, cross-dressing, and gambling. It was a time of social inversion when a mock king was elected to supervise the misrule.

By the nineteenth century its reputation of riotousness was working against it and Twelfth Night was losing out to Christmas as the date for festivities. Victorian values were making the season more respectable and domestic. The gender-swapping and role reversals were theatricalized and absorbed by the pantomime where they became harmless family fare.
Since January 6, Epiphany, is celebrated as the arrival of the Magi or Three Kings, it is customary in many parts of the world to eat a “king cake”, a treat that comes in all shapes and sizes. Readers who remember the Second Gulf War may recall that American petulance at the French refusal to join in the coalition invading Iraq led to many renaming “French fries” as “Freedom fries.” Those who scorned such linguistic pettifoggery may be surprised to learn that our Gallic cousins were first into this fray. During the French Revolution of the 1790s, bakers were told that “gateaux des rois” were no longer politically correct — king cakes now had to be gateaux de Liberté: freedom cakes.
[…] Bowler explains the Twelfth Night, not the play but the end of the Christmas […]