It was executive meddling: the original idea was the machines were using the human's brains as a supercomputer, but it was thought this would be too difficult for audiences to understand.
My head-canon is that the machines were actually just trying to keep the humans from self-destructing, but supercomputer is a fine answer if we still want the machines to be fundamentally antagonistic towards humanity.