The exact reason why boats are called she in English is lost to history. While explanations abound, most appear to be of the folk variety, assumed or invented after the fact as a way to make sense of the phenomenon. Boats are a truly interesting case in English, as they are among the only inanimate objects that take a gendered pronoun, whereas most others are called it. Countries are also called she, as are cars sometimes, but the latter example is almost certainly an extension from boats.
One plausible theory is that boats are traditionally given female names, typically the name of an important woman in the life of the boat's owner, such as his mother. It has also been surmised that all ships were once dedicated to goddesses, and later to important mortal women when belief in goddesses waned. Interestingly, although male captains and sailors historically attributed the spirit of a benevolent female figure to their ships, actual women were considered very bad luck at sea.
A second theory points to the existence of grammatical gender in most Indo-European languages besides English. While Modern English has hardly any grammatical gender, limited for the most part to cases of natural gender, such as the nouns "woman" and "man" being called she and he respectively, there is evidence that English once had a more extensive system of grammatical gender, similar to that in languages such as German and French. In most Indo-European languages with grammatical gender, the word for "ship" is feminine. In Old English texts, there is more evidence of objects being given a gender.
Because English is an Indo-European language, it is most likely that it once had grammatical gender and lost it, since it would be highly unlikely for all the other Indo-European languages with grammatical gender to have acquired the feature independently rather than inheriting it from a common background. Linguistic historians have postulated that proto-Indo-European, the hypothetical "mother language" to all modern Indo-European languages, originally had two genders: animate and inanimate. The inanimate category later split into feminine and neuter, giving three genders: masculine, feminine, and neuter. As each language evolved, so did this system, so that it has become different in each modern-day Indo-European language.
Whether the fact that boats are called she is a throwback to an ancient system of grammatical gender that has disappeared from English in all but a few instances or an analogy to the reverence that sailors have for the women in their lives, the phenomenon is one of the most interesting anomalies in Modern English. Recently, advocates of gender-neutral or non-sexist language have proposed that ships be referred to as it, like any other inanimate object.