Brewer's: Twelfth Cake
The drawing for king and queen is a relíc of the Roman Saturnalia. At the close of this festival the Roman children drew lots with beans to see who would be king. Twelfth Day is twelve days after Christmas, or the Epiphany.
Source: Dictionary of Phrase and Fable, E. Cobham Brewer, 1894