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 called she because they 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 as to why boats are called she 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 has 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 grammatical gender, such as a shield being called she.
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 its system of grammatical gender, so that it has become different in each modern-day Indo-European language.