First, a note on the question itself.
Humans have been endowed with personalities by nature, and it is not clear (to me at least) if this is a feature or a bug.
In my opinion, this is a statement that constrains the question, since it assumes that the personality is given. To me, it feels a bit like playing god: Artificial (given) Intelligence would hence imply Artificial (given) Personality. This approach to the problem seems to be supported by the next fragment:
a notion of personality is useful
I point to the above because I don't think that artificial intelligence... Intelligence itself, actually, need to be given or assigned, or even have a use in the sense of a purpose.
The previous note was about emergence, which is a topic that user217281728 briefly addressed in their answer. In this second approach, the particular traits just happen, or develop. The interaction between the (so-called) agents and their environment, as well as fellow agents can give place to new behaviour patterns, not designed beforehand.
In an evolutionary approach, if the personality would happen to have an advantage (or at least not represent a disadvantage), then it could just appear. Of course, I am making a number of assumptions and demarcations here as well:
- I am thinking about embodied intelligence
- I speak of evolutionary robotics
- I think on social issues being of importance
- I assume that personality could emerge
Now, an example that I find extremely interesting is that of the little mobile robots which could move around and end-up in a pool of food or a pool of poison. And they, somehow, by some odd chance, recognised or made a relation between signals sent by other robots, and the presence of food. Or not. That was more or less the thing: Some robots (kind of) learned to conceal information and thus had more time to eat themselves. Well, I would have a couple of personality adjectives for such guys.
Here you find the article and here you find some videos and related stuff.
And with that, we land at my last point: We humans put the adjectives, according to our social conditioning. We call Marvin depressive and R2D2 lovely and charming.
If they perceive their personalities as constructive or damaging, will always depend on our own judgment. In the end, it is quite common under humans to disagree on personality issues, too.
Remember when HAL got emotional, on the face of death?
It gets human when it loses its cool, before the flawed-personality human astronaut :)