The origin of candy canes dates back to a German coral master's attempt to keep rowdy children occupied during live nativity scenes in the 17th century in Cologne, Germany. They became a popular Christmas treat despite not being preferred by everyone.