Most of the AI's in films/books/series seems to turn out evil or using destructive/harmful ways of achieving what they want in critical situations because they can't understand the earth's biology. Even though they are just a piece of technology, they should be able to learn about earth's biology and create solutions to the problem of over-population, climate change, etc.

For example, a well known tv-series shows how an AI kills 98% of the population of Earth because the Earth couldn't sustain the overpopulation. She just does what a computer program would do in a tech-environment: wipe and free space and only maintain the critical files. Instead, the rational and scientific minds discover that they can solve the problem without killing most of the population, despite the fact that this way is slower but also more viable for current humans. 

Could a future civilizations develop their A.I. to understand biology so they can make a sustainable world instead of destroy it?