It's called personification.
The term for assigning human attributes is anthropomorphism. Examples are fables and animal cartoons.
personification
personification or anthropomorphism
When an author gives human qualities to an animal in a story they anthropomorphize it.
Actually, personification gives human qualities to non-human things.
something that has human like qualities
Actually, personification gives human qualities to non-human things.
That is called personification.
The opposite of personification is dehumanization, which is the representation of something as less than human or devoid of human qualities.
Personifaction.
Personification
Anthropomorphizing