Folklore

Knocking on wood, or to touch wood, refers to the apotropaic tradition in western folklore of literally touching/knocking on wood, or merely stating that you are doing or intend same, in order to avoid "tempting fate" after making a favourable observation, a boast, or declaration concerning one's own death.

Cultural origins

[source: wikipedia]