In order to answer this question, we must first answer another, very important problem for animal psychologists, whether animals have a concept of self-consciousness.
In the 70s, an experiment was conducted in the United States that made it possible to solve this issue once and for all. The scientist proposed to observe how primates react to the mirror. It turned out that the lower-order monkeys reacted to their own reflection as if they were seeing a different individual in front of them — they even assumed warlike poses to scare a supposed enemy. The higher monkeys in this experiment, on the contrary, recognized their reflection. At first, of course, it also seemed to them that it was a different animal, but after a few days they began to consider their own wool in the reflection. In order to finally confirm this hypothesis, the chimpanzees decided to euthanize and tint the tips of their ears with odorless paint — places that cannot be looked at without a mirror. When the monkeys woke up, they did not understand that something had changed in their image, but when they saw the colored places in the mirror, they showed obvious interest and began to actively touch them. So it became clear that they saw in the mirror not another monkey, but themselves — they compared the reflection in the mirror with the old version of themselves and realized that something had changed in their appearance.
At the moment, it is believed that only five species of animals recognize themselves in the mirror: chimpanzees, elephants, gorillas, orangutans and, oddly enough, dolphins. The rest are either indifferent (for example, cats and dogs do this), or perceive it as a rival (fish, as a rule, attack the one they see in the mirror), or even begin to care for the reflection — this is a typical reaction of parrots.
On this topic, I recall a funny incident that occurred in Canada: Vancouver residents noticed that someone was actively breaking one mirror after another in a parking lot. People even began to get scared that a maniac was operating in the area, but the riddle turned out to be much simpler and more interesting: a woodpecker turned out to be the rioter! He probably saw an opponent in the mirror and tried to fight him in this way.
By the way, experiments with children show that they begin to see themselves in the mirror at the age of about 2 years, while primates do this only by 4-5 years — already in adulthood, by their standards, age.