There is told an old Irish belief that you should knock on wood to let the little people know that you are thanking them for a bit of good luck.
also a belief that the knocking sound prevents the Devil from hearing your unwise comments.
Others have sought a meaning in which the wood symbolises the timber of the cross, but this may be a Christianisation of an older ritual.
It wasn't always wood that was lucky
in older days, iron was also thought to have magical properties, and to touch iron was an equivalent preventative against ill-fortune.