Before answering the question about the emotions, I believe, there has to be answered another question: Why is there no direct control for every robot from the AI?
There are different possibilities in my humble opinion:
Old game or holiday AI
The AI might have been in charge for a holiday place or something similar. The robots had to interact with human beeings and had to show emotions to comfort the humans.
Even if the AI is something like an overlord, it might still have some commandments, it cannot overrule. So it created the best world possible with an internal set of rules.
But even if the robots seem to be individuals, there is no real necessity. Even if the robots act like individuals with emotions, they might be just a part of the overlord AI.
Multi planet AI
As soon, as an AI wants to act over a longer distance, it has to solve the problem of light speed communications. It cannot control the robots, if every command needs a few hours to reach them. And if the AI copies itself into robots, it could face a split brain problem with a certain danger of an internal war.
To solve the problem, it has to create loyal and independent robots. 64
But no single robot should be able to develop comparable powers to the overlord AI. To solve this, every robot get emotions because the overlord AI believes, only a rationale entity could become a threat.
Why not a simple rule to obey the AI? With some hacking skills, a robot or some other entity could disable such a rule. Whereas emotions are a part of the personality of a robot, which could not be disabled easily and perhaps, the robots even do not want to disable them.
Experimental AI
Human emotions are self referential depending on the collected experience of the individual beeings. The development of such a society cannot be calculated cause it creates a complex system. The only way to do research on a system like this is to simulate it.
Why does an AI want to research a society like this might have different causes. Perhaps it wants to invade or conquer a human society or it has an order to research a solution to a set of problems like the meaning of life and the answer "42" was not satisfying. 64