Unfortunately, no one can tell for certain since there are too many stories and rumors about their origin, but I will share the San Francisco version with you.
On this side of the story, the first fortune cookie with a cute message inside was invented in San Francisco in 1914. It was made by Mako...