1. Because constructs, particularly the metal ones, have always been robots in D&D. Iron golems fill the same role as killer robots in innumerable sci-fi stories, movies and serials: implacable, nearly indestructible, mindless killing machines that are often outwitted rather than destroyed. Flesh golems are explicitly based on Frankenstein's monster - and many robot stories descend from the Frankenstein story. Warforged are an outgrowth of golems, which are D&D's most common version of robots.
(Note: I'm aware of the actual legendary background of golems; it has as much bearing on D&D's treatment of them as the actual legendary background of elves or dwarves does, or gorgons for that matter)
2. Because Warforged are explicitly used to explore the same themes as robots in more serious sci-fi stories, from Asimov's three laws 'bots to Data on Star Trek. Becoming human or exploring their own sentience, the potential danger they pose and the danger humans pose to them, etc. All of these thematic territory has been explored with robots.
3. Because they LOOK like robots in most depictions. Magic robots, yes, but robots all the same.
4. Because I want robot PCs in my fantasy. It was good for Chrono Trigger, it's good enough for me.