Why are pets friendly to the owner, but can be dangerous to a stranger?

The owner feeds him, looks after him and he (she) tries to protect himself and the owner. And the animals think in their heads that they are threatening him, they are trying to kill him.

One of the components of a person's success in our time is receiving modern high-quality education, mastering the knowledge, skills and abilities necessary for life in society. A person today needs to study almost all his life, mastering everything new and new, acquiring the necessary professional qualities.