Miraculous Malfunction

In mad science, "malfunction" does not mean fried circuits and broken equipment. Well okay - that too. But quite often it turns out that a malfunction has created something wondrous (rather than just, yknow, giving you extra work). Usually there is no explanation to how a "malfunction" can make modifications that seem almost intelligent, and no mention to where it gets the parts for a technology that is entirely different from the intended - a toaster can easily become a time machine through Miraculous Malfunction, for example.

This can be used as an Achievement In Ignorance for the Bungling Inventor (most of whose works are created in this manner). It can also serve as an alternative explanation to why there are No Plans No Prototype No Backup: it's not that the technology was lost but rather, the individual sample was a result of a one-time event that cannot be recreated. Particularly good researchers might then learn to reverse engineer this piece to create more, but usually they will be just as dumbfounded about how it works as everyone else even if they themselves have created it. Surpringly such technology will usually be surprisingly stable and not at all prone to Phlebotinum Breakdown, unless the plot suddenly calls for it Going Critical. Note, however, that because of the poorly understood nature of such technology it can unexpectedly become dangerous.

(While there are real-world examples of inventors accidentally stumbling upon new things while researching something else, the fictional inventor will never need to bother with follow-up research: they will get the new tech from it ready-made.)

Sister trope to Freak Lab Accident which gives people powers rather than creating and changing technological pieces. See also Instant AI Just Add Water.

Anime and Manga

 * In Ghost in The Shell Stand Alone Complex the tachikomas  They did try that with the fujikomas, yet that did not work. They never quite figured the reason out.

Comic Books

 * The material that became Captain America's circular shield was created accidentally during an experiment to merge vibranium and an iron alloy. An unknown catalyst entered the mixture while the scientist overseeing it was asleep.

Film

 * Short Circuit: a robot is is struck by lightning which causes a "malfunction" that gives it sentience.
 * Happens in the 1984 film Electric Dreams: the hero, Miles, spills champagne on his PC while it is plugged into his company's megacomputer, causing his computer (of course!) to come to life.
 * Honey I Shrunk the Kids: a stray baseball landing on the shrinking machine is what actually makes it work. Though Wayne Szalinski is able to figure out why the baseball made the machine functional, and replicate the results.

Literature

 * Dirk Gentlys Holistic Detective Agency - Professor Chronotis' time machine seems to be in a strange relationship with the telephone system. After he has his phone repaired, the time machine is inoperable too.
 * Isaac Asimov's stories have several examples of unusual robots coming into being via a Miraculous Malfunction:
 * In the Lije Bailey series, the psychic robot, Giskard, is created this way.
 * "Robot AL-76 Goes Astray" has the robot of the title managing to create a mountain destroying mining laser that runs on two D-batteries after being exposed to unexpected stimuli when lost on Earth.
 * In "Liar!", a robot became psychic due to an error when they were building the brain. Nobody could figure out how it happened; the robot knew but couldn't tell because of the First Law: it would hurt the human engineers to know that a robot knew something they didn't.
 * "Light Verse" has a malfunction makes a robot hopeless at housework, but somehow, able to create incredible art.
 * "Lenny" begins when a small child is touring the factory where robots are built and plays with a keyboard a bit when they adults aren't looking.
 * Not a pure example, since the malfunction did screw up the robot and revert it to the intellectual level of an infant. The roboticists just realized this would be a good opportunity to study mental development in robots.
 * It's noted in "The Bicentennial Man" that Andrew was the result of a production error. US Robots tightens their controls as a result to prevent it happening again since expressive robots who want to be human are bad for business.
 * The Strange Case of Doctor Jekyll and Mr. Hyde: An impurity of salt is what makes the transformation from Dr. Jekyll into Mr. Hyde possible.
 * In Memoirs of an Invisible Man, it's implied that someone spilling a cup of coffee on a control panel resulted in uncontrolled but permanent invisibility, in a lab who's research had nothing to do with invisibility.
 * In the Discworld books, this is the best case scenario of allowing Bloody Stupid Johnson to build anything.

Tabletop Games

 * Genius: The Transgression does not make use of this trope, curiously; rather, any new technological piece created by a genius is one-of-a-kind called a Wonder. Normals can cause breakdowns, but it stays on the "tweaking the original" level.

Western Animation

 * In Cloudy With a Chance of Meatballs, Flint hooks up his machine to the town's power station to give it enough electricity to create food from water. Instead, the extra power makes the machine take off like a rocket and start orbiting in the lower stratosphere, creating food that comes down in showers using moisture from the clouds. Later, being overworked makes the machine start overmutating the food and it eventually gains sentience.
 * Invoked in an episode of The Adventures of Sonic the Hedgehog, where Robotnik explicitly says that the creation of his "Super-Genius Program" was a million-to-one shot - and after the program is stolen and he orders his computer to make it again, the computer has to remind him of exactly this fact (which he said himself not five minutes before!).

Real Life

 * Real Life: R.W.Wood in one experiment noticed that a heating circuit is broken, but a wire in a glass with atomic hydrogen not only doesn't cool, but in fact is white hot. This provoked some useful research on recombination and the invention of atomic-hydrogen welding.
 * Real Life: Iodine was discovered completely by accident as a byproduct of adding too much sulfuric acid to the waste left over after making saltpeter (a component of gunpowder) from seaweed. After the initial fight over who had discovered the new element, there came the question of what to do with it. It dyed and stained things well, but didn't smell too good, so it was given to soldiers to use to mark the wounds of those who had been shot, stabbed, etc. in battle. Surgeons of the period quickly noticed that soldiers whose wounds had been marked by iodine were far less prone to infection.