Although popular sources often trace the superstition that thirteen is unlucky to the Last Supper (which no doubt popularized the notion that Friday the 13th is an especially unlucky day), such beliefs about the number 13 predate Christianity. Likewise, numerologists' obsession with twelve as a mystically complete number (which makes 13 one more than complete, or some such thing) may not tell the whole story. While we many never know the precise reason for triskaidekaphobic's favorite superstition, it may have to do with the menstrual cycle.
A month is, after all, not a human invention, but a fact of astronomy and biology. Month means moon, and the moon passes through its cycle approximately every twenty-nine days or nearly thirteen times a year (twelve and a portion, with 12 full moons most years but 13 during some). The menstrual cycle is one of 28 days, and so the statistically typical human female of child-bearing years menstruates thirteen times annually. To many ancient cultures, the number thirteen would have had positive or at least powerful associations, because of its connection to fertility.
The legacy of thirteen might live on in a number of ancient organizations which were connected with power. Thirteen sat at the Last Supper because the group assembled had always consisted of thirteen members: Jesus and twelve Apostles. The death of Judas changes nothing, since he is later replaced.
Texts on Classical Mythology refer to twelve great Olympian deities, but cannot agree on whether Hestia or Demeter belong on the list, which suggests an earlier council of thirteen. Even sources that provide a definite list of twelve note that the wine-god Dionysus is later welcomed into the inner circle, again making thirteen-- with no ill effects, save the odd divine hangover.
The Norse had thirteen principal gods, prior to the death of Balder. The Celts apparently considered 13 to be quite lucky. The membership and symbology of the knightly Order of the Garter is based on thirteen and multiples thereof. And popular (though again, comparatively recent) lore puts thirteen witches in a coven.
And yes, other, astronomical explanations exist for the prominence of thirteen. We're into heavy speculation here.
Nevertheless, if the number thirteen had powerful associations, why has its reputation been besmirched? That question remains more difficult to answer. Sometimes newer cultures vilify the beliefs and traditions of the earlier cultures they replaced, and this may have happened with thirteen. The more male-dominated cultures have been known to demonize specifically those beliefs with female associations. Once a belief has been established, it tends to be perpetuated.
Every time we enter a building with no thirteenth floor, we're reminded that thirteen is bad luck. Every time Friday falls upon the thirteenth, we commemorate each disaster ever associated with the number thirteen. If we instead compiled positive associations for the number, a very different set of recollections might exist in the public memory.