Voting machines could, in theory work.
One problem is that the people who have the power to make them work correctly stand to gain considerably making them work incorrectly. This means that they need considerable oversight and verification, which annoys the people making them because it suggests they’re untrustworthy. They may or may not be trustworthy; the key is, the entire process needs to be completely above suspicion.
And then when there’s no paper trail, and it’s discovered that anyone with physical access to the machine (such as when it’s in a voting booth being used) can alter the vote tallies—well, that tends to make the whole process suspicious.
It’s also a real problem that local boards of elections and election volunteers, who have years of experience supervising paper ballots, have no way of judging the reliability and trustworthiness of electronic voting machines and no way of detecting fraud even if it should happen right under their noses.