Screw the Matrix or Sky-net. Those are incompetent and incapable of exterminating the human race no matter what they try or how advance they become.
The only one capable of doing it as far as I know from playing games is the Faro Plague from Horizon Zero Dawn. These guys …
What made them special is that they did not go after human race at all. Instead they went after the very thing that we all dependent on and yet take advantage of because of its abundant - Nature itself - through Biomass Conversion System.
First they destroyed a small area of its biomass and then use that energy to create new machines like the Corruptors and other weapons of war. In the game (Horizon Zero Dawn), it started at Timor Leste. The company (run by Ted Faro) made a crucial mistake - he thought he could control the swarm in matter of days and he could use his money to fix it like it never happened. That time allowed the Swarm to grow in size, enough to create Corruptors in masses.
Another mistake is that the human army were made obsolete by introducing these machines of war as “Peace Keepers” so by the time they are detected as threat, humans threw more machines toward the swarm only to have them hijacked and turn against the humans. Very much like what Skynet did just before Judgement Day when it started to take over both military and civilians servers and shut down them down.
In the end, they only had 18 months to live before the Earth become a toxic mess and no life can survive. 18 MONTHS to bring down not only the human race but also everything that was living on our World.
In summary, any attack machines does on our environment WILL have a catastrophic chain reaction which will spiral onward. First the food production will face destruction which lead to wide scale riots and chaos. That will lead to collapse of central government which means there is no organized military to counter-strike the threat, allowing it to expand greatly.
By the time anyone can get anything organized, it could be too late. The environment could become too toxic and billions could have died. But the physical bodies of these dead then become biomass for the machines to create more machines and this will continue until nothing remains. That could be most logical way an AI destroy the human race.
Even if you say that the AI only wishes to kill humans and not harm Nature or non-humans living there, destroying the environment is the best methods because with our current technology, we could upload information on how to plant and take care flora-lifeforms into machines as we prepare them for farm-work within next decade to come. They could kill humans and replant the World and make it green again.
Footnotes