The story
Ellipsis of speak of the devil and he shall appear, which can be traced back to “talk of the Devil, and he’s presently at your elbow”, attested in 1666. The idea behind this (namely, that mentioning a dangerous creature may cause it to appear) is found in many cultures around the world; see taboo avoidance.
Etymology from Wiktionary, CC BY-SA 4.0.