The AI has been given a task, and training protocols reward completing tasks with little regard to how they are completed. AIs completing tasks in unexpected and harmful ways with unanticipated side effects is a major issue. Seriously, you need to look up the alignment problem, it’s crucial to understanding this kind of AI behaviour.