It seems that this belief comes from two legends of Norse mythology.
According to the first of them, there was, in Valhalla - the heavenly abode of the deities - a feast for 12 guests.
Loki, spirit of evil and discord, appeared without being called and set up a fight in which Balder, the favorite of the gods, died.
It was then superstition that to invite 13 people to dinner was a disgrace indeed, and this number was marked as a symbol of chance.
The second legend is played by the goddess of love and beauty, Friga, whose name gave rise to the words friadagr and friday, "Friday" in Scandinavian and English.
When the Norse tribes converted to Christianity, the character was transformed into a witch exiled high on a mountain.
To get revenge, Friga met every Friday with 11 other sorceresses, plus Satan himself, in a total of 13 participants, to plead for plagues on humanity.
From Scandinavia, superstition spread throughout Europe, reinforced by the biblical account of the Last Supper when there were 13 people at the table on the eve of Christ's crucifixion - which happened on a Friday.
In the (Jewish) Old Testament, inclusive, Friday was already a troublesome day since the earliest humans. Eve would have offered the apple to Adam on a Friday and the great flood would have begun the same day of the week.