There are several theories as to why the number 13 is considered unlucky:
13 turns make a traditional hangman's noose. Anything less would not snap a neck. (I don't know if that is true or not. I have not tried it.)
At Jesus's last supper, there were thirteen people around the table, counting Jesus and the twelve apostles.
On Friday 13 October 1307, King Philip IV of France ordered the arrest of the Knights Templar.
A year which contained 13 full moons instead of 12 posed problems for the monks who were in charge of the calendars. This upset the regular arrangement of church festivals.
In ancient cultures, the number 13 represented femininity, because it corresponded to the number of menstrual cycles in a year (13 x 28 = 364 days). The theory is that, as the solar calendar triumphed over the lunar, the number thirteen became anathema.
Ancient Persians believed the twelve constellations in the Zodiac controlled the months of the year, and each ruled the earth for a thousand years at the end of which the sky and earth collapsed in chaos. Therefore, the number is identified with chaos and the reason Persians leave their houses to avoid bad luck on the thirteenth day of the Persian Calendar, a tradition called Sizdah Bedar.
In the Viking tradition, it is believed that Loki in the Norse pantheon was the 13th god—more specifically, Loki was believed to have engineered the murder of Balder, and was the 13th guest to arrive at the funeral.