'He' and 'she' can only be used to describe things that are biologically male or female.
'It' can be used to describe anything not human.
If you say 'he' or 'she' to refer to an object, people will be confused and will think that you're literally talking about a person.
Technically animals could be called either 'it' or 'he/she' (because they're not human and because they can be male or female). Unless you're talking about your own pet, you should always say 'it'.
A: I have a cat. He has black fur.
B: I also have a cat. She has white fur. Look at that cat. It is very fat!
Sometime's in fiction (especially children's books) or in poems, objects will be called 'he' or 'she'. When this happens, the author wants you to literally imagine that the object is a talking, living person.
For example, if I write a book about a talking tree, I'd probably refer to that tree as 'he' or 'she' (depending on whether I want the tree to have a male or female personality) instead of 'it', just because I consider the tree to be a person.
There's only one exception that I can think of.
It's tradition for sailors in the navy to call ships 'she'. Very serious sailors also sometimes adopt this tradition, but otherwise ships should always be called 'it'.
Sometimes people who REALLY like their car do the same thing. This only happens when their obsession with their car is so great that they literally think of their car like a wife or girlfriend...it's weird.