Some people do this sort of thing from affection. I know I do with Ivan, but that's also mostly a joke--Russia made millions of them. They're all Ivan.
Militaries do (or did) that for planes, tanks, artillery, and rifles.
Tank 'Bg RSe' will get its oil and treads changed according to procedure, but 'Big Rosie' will get her oil changed regularly and all her fluids checked, air filter cleaned, and all the rivets and suspension looked over whenever it's parked for the night. If it's got a name, someone's more likely to be attached to it, and in turn is more likely to maintain it. A crew might know they and their tank rely on each other, but they can replace their tank. Big Rosie, however, is a partner.
Other people do it from a sort of superstition. Thinking cars complain if you curse at them, or if they need some coaxing (or percussive maintenance), that sort of thing.
I generally don't name things, but do understand that some vehicles or firearms have a 'personality' or at least a collection of quirks and preference for what you feed them. Naming them just makes those seem more like a personality instead of an inconvenience.