As far back as the 19th century, traditional cookies very similar to today’s fortune cookie have existed, most notably in Japan; called O-mikuji (random fortunes written on strips of paper at Buddhist temples. These are usually received by making a small offering of money and randomly choosing from a box, hoping for the resulting fortune to be good. Up until World War II, fortune cookies were known as fortune tea cakes.
Golden Gate Park’s Japanese Tea Garden in San Francisco is reported to have been the first place in the USA to have served the modern version of the cookie at the tea garden in the 1890s or early 1900s. Fortune cookies moved from being by Japanese-Americans to Chinese-Americans sometime around World War II. These were all made by hand until the early 20th century, when the first fortune cookie machine was invented by Shuck Yee from California, called Fortune III.
Fortunes can be anything from quotes to life advice. Some fortunes are left blank, requiring you to pen your own to gift to friends and family. But how does the fortune get into the cookie? Once the cookie batter is made, poured and baked, vacuum is used (built into fortune cookie machines) to suck fortunes into place, metal fingers fold the fortune in half to trap the fortune inside, bend the cookie into shape, and cool and package the final cookie.