Following on from Barrie's answer: in everyday English, there is an attempt to be reasonably logical when it comes to ascribing 'false gender' (or guessed gender for animals that could be sexed if one made the effort). We don't have bikes of both sexes (all right, genders!) like the French (une bicyclette but un vélo) or bewildering cutlery as in German where the spoon is masculine (der Löffel), the fork is feminine (die Gabel), and the knife is neuter (das Messer). Ascription of gender in English is really metaphorical rather than haphazard - dogs 'feel' masculine, cats feminine, partly because of their typical characters and behaviours, but also because of general appearances. This is an imperfect approach, of course, as some dog breeds are far more silky and graceful than others, and hence have a more feminine appearance.
This ascribing of gender carries over into obviously metaphorical cases, where a (perhaps begrudging) sentimentality often classes cherished articles as feminine. Cars, boats, planes (especially WW I fighters!) and locomotives, because of their graceful lines or movement, and perhaps their capriciousness and ability to frustrate, are / were often referred to using she rather than the clinically correct it.
We mustn't expect there to be no problems with this convention:
"There's the *Duke of Gloucester!"
"Yes, she's a beautiful locomotive."
(courtesy of The One Show)