It is a Japanese Tea Garden introduction. It was introduced as refreshment to be taken while strolling in the Japanese Tea Garden by Makoto Hagiwara.
This confection is a very old folk art long known in Japan as 'Tsuji ura sembei' and is associated with New Year festivities at Shinto Shrines. This idea was introduced in San Francisco at the Japanese Tea Garden, Golden Gate Park.
The confection, as it is known in Japan, is not sweet. The sweetening of it was done to suit American tastes. This novel idea of receiving a fortune in a light sembei cookie is known throughout Japan and has been known there for many generations. (It was/is a felicitous thing to receive a good luck fortune on the New Year from a local Shrine.) The Hagiwara family was not business oriented and there was never a patent taken out on the fortune cookie in any form (name, rights, cookie itself, or otherwise). During WWII, local Chinese usurped the idea and began to market it as their own.
Fortune cookies are very popular in North American Chinese restaurants, many if not most of which serve them as a dessert with every meal. These fortune cookies often contain, besides fortunes, lucky numbers (used by some as lottery numbers) or even a phrase in Chinese along with its English translation. Fortune cookies are almost unknown in China.
See also: American Chinese cuisine