That would require consiousness and intent on part of the AI but we can have highly autonomous agents with no consiousness and intent as well and most likely that's what we will get. It still cannot just magically get free will, intent, and the ability to "eliminate humanity".
Wouldn't need any of that. An AI agent setup to "Do the best for the world" or some other broad claim, and with enough power to say crash the stock market, disrupt power supply, delivery, etc etc after reasoning that it's all for the best.
If people start giving enough power to AI, with ill thought out goals, and no human in charge, don't be surprised...
Why would it need "free will" or "consciousness" whatever that means?
A concrete example might be putting an AI in charge of health policy, and telling it to "eliminate suffering" without any human to check and push back. Well, the best way to eliminate suffering is...