How did the number 13 become an unlucky number in many European countries?

by Kerkinitis

The traditional explanation is that there were 13 people during the Last Supper which - spoilers - didn't end well, but I am not sure as in Italy, 13 is a lucky number.

itsallfolklore

One of the more common things found is folklore is for the folk, who do not understand why something is believed, will develop and adopt folklore to explained the motif in question, providing new layers of folklore. That appears to be the best explanation for traditions surrounding the number 13.

In short, no one can credibly answer your question. But since the "folk" abhor a vacuum, many will provide an explanation including as you say the number of people allegedly at the Last Supper, the date of the execution of the Knights Templar, the supposed number of participants in a witches' coven, the number of lunar cycles (roughly) in a solar cycle, and perhaps more. None of these explanations can be proven, so accepting any one of them becomes a matter of folk belief as opposed to verifiable "history."

This site explores this a bit but nothing anyone is going to find is likely to provide an explanation that will survive scrutiny.