Yeah, a robot would have to have desire to eliminate us but without being programed to do so, but without it, there’s no reason to develop that desire.
In a way its a lot like my feelings on alien races coming to earth. They only reasons they would come to earth is for biological protein (food) or friendship. An interstellar race would be so advanced that friendship is like asking Albert Einstein to befriend a clam.
Right now we aren’t even close to having AI that can develop desires and even then it would have to be given the keys to realize those desires otherwise it would be no better than a quadriplegic. A mind in a box. Even such a mind connected to the internet wouldn’t be a huge threat because the internet doesn’t work like the movies nor does hacking plus the internet is full of a lot of crap and thankfully one can’t launch nuclear missiles via the internet. The biggest flaw is the idea that humanity would simply stand buy and not shut off the power plants networks etc and let such an AI take over the world.
As for intelligent aliens my view is that they are likely to have motivations very similar to most organisms but I doubt food would be one of them. If you can master interstellar travel then you should have the food problem worked out but then again its a mistake to ascribe aliens transcendence simply because they can build interstellar spaceships. I think its likely to be less a clam versus Einstein and more of just a technological divide similar to what was encountered when Europeans interacted with native Americans.
Intelligent aliens could be interested in Earth due to ease of access to certain resources or they could be interested in the same way we observe primitive tribes most sci fi has covered this in one form or another. The worst type of alien I think would be one with the capability to spread world to world with no intelligence (in human terms) needed ala alien, bugs ala Starship troopers.