One of the most widespread theories is that 13 is unlucky because it was the number of people at the Last Supper. But this can hardly explain why the number was unlucky for at least 2500 years before Jesus was born. It is possible that the story of the Last Supper helped spread the fear of 13 in Christian Europe, but it can't be the original explanation.
The real explanation is the human discomfort with the discrepancy between the solar and lunar calendars. Ancient peoples had two main ways of keeping track of time, beyond days: solar years and lunar months. Humans like things to work out, so we very much want years and months to work together. There are about twelve months in the year, so most cultures have some version of the twelve month calendar. But since this is not quite right, your months get more and more out of whack each year, until your harvest moon falls at planting season. Ancient astronomers figured out that you have to insert an extra month every so often to keep the two calendars aligned. Because this month represented the bad connection between the two great celestial calendars, it was considered unlucky. This is not a guess; the Babylonian astronomers who invented this 12/13 month calendar explained it at great length in their treatises. I read about this in a wonderful book by French Assyriologist Jean Bottero, best known for asserting that since the study of ancient languages is the most useless of all human activities it is therefore the highest and most important.
Wikipedia, incidentally, has the correct answer, although they phrase it as if it were uncertain:
one theory is that this is due to the cultures employing lunar-solar calendars (there are approximately 12.41 lunations per solar year, and hence 12 "true months" plus a smaller, and often portentous, thirteenth month).And there you have it. This is not a mystery, or a subject open to discussion, or which everybody gets to have his or her say. It is a question of fact with one and only one correct answer.