The Zoids Bible says that the eponymous zoids originally evolved from a planet seeded with zoid cores, going through eras of evolution uncannily similar to those of life on Earth, and the zoids shown are post-domestication beings.
In the original The Transformers comic book series, the Transformers themselves were once described as evolving from "naturally-occurring levers and pulleys". This was later Retconned into the Transformers actually having actually been created by a deity figure; the levers and pulleys thing turned out to be a theory they themselves had developed about their origins after having forgotten their true origin.
That said, the development of Micromasters, Pretenders, Powermasters, and so forth could be considered a form of this; a new mechanical trait is invented (a smaller form that's more energy-efficient, a new type of transformation disguise, symbiotic partnerships, etc), and those with the new trait quickly outcompete those without, removing them from the story, if not from living.
In a Paperinik New Adventures issue, we know an alien race of robots. Their origin is unknown, but they're theorized either to descend from the computers of a ship who crashed on their planet, or to have evolved like every other race "only starting from microcircuits instead of microorganisms". Makes no sense, but who cares as far as it sounds so cool?
This is often invoked by The Avengers villian Ultron to justify new powers and appearance whenever he returns.
Films — Animated
Syndrome's master plan in The Incredibles was to build and evolve a robot by pitting it against gradually tougher Supers; eventually building a machine strong enough to take out his nemesis Mr. Incredible and wiping out the remaining Supers in the process.
But the machine evolves even more and is soon out of Syndrome's control.
Films — Live-Action
The Terminator series, in many media. In a Robot War, the central AI Skynet notes what designs for its killer robots are effective and which aren't and feeds this knowledge into the design of next batch. The result is increasingly more lifelike humanoid robots able to fool the survivors' and gain access to their shelters. Too bad they also apparently emit the strong smell of dog food. Reese mentions in passing that the "current" generation of Terminators are the first full cyborgs with true organic skin, they replaced earlier models that had unconvincing rubber skins that made them easy to spot as fakes.
Steven Spielberg's A.I. deals with the societal consequences of humans designing ever more intelligent and human-like robots, culminating in an autonomous robotic civilization surviving the extinction of humanity due to climate change.
The film Bicentennial Man, where the eponymous character decides to "upgrade" himself - becoming ever more human in the process. In the end, he dies of old age, because as he put it "I would rather die a man, than live for all eternity as a machine".
The Gaijin from Stephen Baxter's Manifold: Space are subject to this, with errors creeping in with each replication. A visit to their homeworld confirms that they were never built by anyone else but really did naturally evolve from scratch.
Gregory Benford's Galactic Center novels have "mechs" which evolved from self-replicating von neumann machines, after they were abandoned when their biological creators destroyed themselves.
Harry Harrison's short story The War With the Robots. With war becoming ever-deadlier, the retreating to bunkers deep underground, using robots to fight. The robots on either side design ever more effective robot forms, eventually able to drive the humans out of the opposing bunkers. The now-obsolete human race is shocked to find itself sidelined from what used to be their war.
An early example is Second Variety by Philip K Dick, first published in 1953. The UN, losing a war with the Soviet Union sets up automated factories to produce "claws" — at first just mobile sawblades seeking warm bodies. Later the claws produce new, more effective designs which mimic human beings. The new varieties are able to infiltrate humanity, spreading paranoia as well as death. In a twist, the story concludes with the observation that some claws are developing weapons specifically to kill other claws.
The Isaac Asimov story "Found!" is about two astronauts repairing a satellite who find that it's now host to alien machine lifeforms that consume metal and oil.
In Poul Anderson's "Epilogue" two astronauts hit a Negative Space Wedgie and do not return to earth for millions of years. After a nuclear war, the machines left behind, which are already capable of self-replication, had evolved. It specifically says that radiation could damage the robot's data tapes just like it can human genes, thus letting them evolve. The mechanical lifeforms are unable to understand humans, and see them as entities with "poison under their skin" (oxygen). The humans use oxygen and eventually a transmitter in self-defense against them. The moon is worn but mostly unchanged.
A similar event happens with the roboticecosystem that developed on Titan in James P Hogan's Code Of The Lifemaker. Aliens send a mining colony, which gets damaged by supernova radiation and as a result ends up gone wonderfully wrong, with self-sustaining systems and, at the top of it all, sentient robots who are a Fantasy Counterpart Culture for late medieval to early modern Europe (about the time of The Renaissance; the humans who show up even call the robots' city-states by the names of those of Renaissance Italy).
Invincible, a novel by Stanisław Lem, is about an exploratory expedition discovering an ecosystem of micromachines, evolved from a lost alien civilisation's Colony Ship's robotic crew.
In Stephen Baxter's Evolution self-replicating robots evolve just like organic beings: software errors are possible in every new assembly, and those machines that benefit from theirs are more likely to reproduce at a higher rate. Mankind goes extinct without realizing that its automated Mars rovers will spawn a Galaxy-spanning civilization.
That's left unspecified by the story; the main characters could just as well be Energy Beings instead.
Especially since at the end they mention a "hydrogen core cluster intelligence" in a class 9 star that wants to get friendly.
The species that are referenced include one carbon-based race that "goes through a meat stage" (possibly Brain Uploading) and another that has a stellar plasma brain encased in a "meat" head.
In Perfect Imperfection by Jacek Dukaj all the civilisations breed so-called Wars - pocket universes full of nasty reality warping warmachines. In book, the machines inside of Wars are said to evolve.
In the distant back-story of Caprica and Battlestar Galactica intelligent machines evolve into humanoid machines and leave their human masters to found a colony (named Earth) as their former masters are also forced to abandon their home and end up founding 12 colonies. On Earth, the humanoid machines build their own sentient robots — who themselves want to evolve and who therefore rise up to destroy all but five of their humanoid creators. Meanwhile, on the human colonies, people have created yet another generation of intelligent machines. The union of these two machine races finally leads to the creation of the human-model Cylons who appear in Battlestar Galactica.
And the union of those human-model Cylons and the Colonial humans along with another genetically compatible but unrelated planet of humans leads to the creation of modern human race, namely, us
The Replicators from both Stargate SG-1 and Stargate Atlantis both use this. The SG1 Replicators as part of their story arc, the Atlantis ones as part of the backstory.
Referenced in the 2 Broke Girls episode "And the Pearl Necklace," with plotlines about a technological upgrade to the way the girls take orders at the diner and the possibility that a cupcake-backing machine will make their business plan obsolete. Max freely and frequently references the Terminator and Matrix franchises.
The geth, a "species" of software-based synthetic lifeforms housed in mobile platforms and vast networked servers, have been actively evolving themselves over three centuries since their war with their quarian creators, developing advanced technology that runs a course greatly different from the rest of the galaxy's species. By contrast, most other species are following a common technological path, exactly as the Reapers want them to.
The Reapers consider themselves to be the pinnacle of all evolution (mechanical or otherwise). They see organic life as nothing more than a strange accident, useful only as something to be harvested when necessary to further the development of "true" life. The Catalyst indicates that this is only partially true, and that part of the point behind the Reapers is to prevent the evolution of complex synthetic life by destroying organic civilizations before they can reach the singularity that would result in a superpowerful synthetic form of life taking over the galaxy. It is implied by Sovereign that deliberately seeding the galaxy with Reaper technology causes organic life to develop down certain tech paths, which helps the Reapers control and harvest them and stymies the true development of AI.
In both the Xenogears and Mega Man Legends video games, the heroes find out that the species on the planet are not humans, but evolved descendants from the biological parts of ancient human technology.
The Pulverizers in Armored Core: last raven, as each one gets defeated a new one is made that's even faster and more powerful than the previous one, with tanks being the weakest and the strongest being a crazy airborne spidery looking thing that gives the alien queen a run for its money. The humanoid one, interestingly, sits in the middle of the spectrum in regards to strength.
Present in Mega Man X in a rather unique form: all reploids are 'replica androids' derived from the titular X, who was designed with 'limitless potential,' the capability to evolve to (hopefully) overcome any obstacle he was presented with. This makes him simultaneously one of only two (actually only one) people capable of resisting The Virus and extremely important to the goals of The Virus: as he's forced to fight and evolve, more and more powerful reploids can be made based on him, allowing the species itself to evolve over time. This was mostly ignored after the first game in the original version (where it explains a sudden power-up after a Heroic Sacrifice) until it became relevant again in the eighth game: the remake of the first game placed more emphasis on it, with the Big Badaware that the more X fought and stopped their plans to Kill All Humans, the stronger his own forces would become.
How the Glitch came to be in the upcoming game, Starbound. There were originally several other robotic races similar to that built by the same empire on different worlds to simulate sociological and technological progression but they always wound up destroying themselves each time they advanced to a certain point. The exception comes from one planet where, well, a glitch caused them to be stuck in the medieval times which allowed them to survive for so long.
In S.S.D.D the Oracle was designed to be self-improving, the rationale being that once it was running and debugging itself the programmers could be fired or imprisoned (they were hackers after all). In fact one of its programmers was an expert in evolutionary algorithms (see below), though he mostly created viruses that could mutate like biological ones.
Is it any wonder why the Oracle is the only AI capable of copying itself?
And now that Kat is starting to unlock the secrets of the original designs, there is a growing segment among the robots which believes she is literally an Angel.
The Dig-Bots from Sluggy Freelance keep on reproducing for several years, until they've created several variants like the Brain Dig-Bot, Bouncer Dig-Bots, High Priest Dig-Bots, and Trash Can Dig-Bots.
Inverted in Girl Genius. Agatha tends to compulsively construct little Clanks termed "dingbots". These dingbots can then go on to construct more dingbots, but dingbots are only so bright, so each successive generation gets less and less advanced, and less bright, and by the third or fourth generation the dingbots produced are nonfunctional.
In Questionable Content, AnthroPCs (robotic companions) can "upgrade" their chassis. This happens at least twice, with Pintsize and Momo-tan, and works in conjunction with the fact that the author of the strip is constantly evolving his artwork.
Doctor Steel believed that robots would eventually evolve to the point where they would replace man, who by that time would have polluted the world so much that only his machine creations would be able to survive anyway. (He even published a paper on the subject.)
In order to deconstruct the common creationist Straw Man argument that evolution is false because watches do not build themselves from smashed partsnote which completely ignores the fact that watches don't reproduce, so they can't evolve cdk007 made a video, Evolution IS a Blind Watchmaker!, in which he wrote a computer program that simulated clocks evolving from their parts, with results that look as though they could have been specifically designed, but in fact, were not.
On Justice League, AMAZO's ability to evolve was so potent that by his second appearance he had even evolved beyond being a machine.
In the Futurama episode "A Clockwork Origin", Professor Farnsworth releases some Nanomachines to purify water on an uninhabited planet. Subsequent generations of nanites are more complex, and the situation very quickly gets far out of hand.
In Beast Wars, the Autobots and the Decepticons decided to change to more energy-efficient forms called the Maximals and the Predacons, respectively, in an event called The Great Reformatting.
The "evolution" of the automobile through the years (along withMickey Mouse's) has been used as a parable of biological evolution in educative works.
YMMV on whether or not this is logical. It's certainly an example of evolution (change over time) but the analogy would really be for Intelligent Design (at least if the designer was doing it on the fly each generation) than for Natural Selection (or some combination there-of if that even makes sense: an intelligent designer deciding which traits to continue, which to change, and what new things to add based on the competition between models and market forces)