How did the joke of throwing a pie in face originate?

There is no single definitive origin of the pie-in-the-face joke. Here are two possible scenarios:

1. Vaudeville and slapstick comedy: In the early 20th century, vaudeville and slapstick comedy routines often featured characters getting hit in the face with various objects, including pies. These routines were meant to be humorous and often employed exaggerated physical gags. The use of pies, in particular, may have gained popularity due to their messy and comical nature.

2. Mack Sennett and silent films: The American filmmaker Mack Sennett is often credited with popularizing the pie-in-the-face routine in silent films during the 1910s and 1920s. Sennett produced short comedy films known as "Keystone Kops" and featured actors throwing pies at each other's faces for humor. His films received widespread popularity, helping to solidify the pie-in-the-face gag as a staple of physical comedy.

Over time, the pie-in-the-face routine became a widely recognized visual joke and continues to be used in various comedic situations, films, television shows, and stage performances.