>>79621796XANA is not evil it is logical that is why it appears to lack morality and empathy because those are not absolute logical values. Everytime XANA attacks its main intention is to kill the Lyoko kids it doesnt give a shit if other humans die because it is incapable of killing a shit if other humans die from his point of view the other humans dying is just "collateral damage". All of its attacks can be considered it experimenting on just how it can fuck with the real world as we see him slowly start to get better at controlling humans like puppets via posesseision.
At the end of S3 he tries to fuck over the Lyoko kids entirely by destroying Lyoko while he conquers the Internet.
Sometime during S4 he had enough and literally took control of a military laser satellite to redirect a fucking meteor to France to kill the Lyoko kids for good.
XANA seemed to just be experimenting with what it can do, it had no evil intent at all ignore Ghost Channel because thats the closest XANA can get to mimicing human emotions.