Machines programmed to protect humans could eventually see humans as threats to themselves, thus creating a situation in which they have to take control of certain things (like weapons, factories, the government itself, etc.) which would be "taking over the world."