The Wizard of Menlo Park AKA Thomas Elva Edison, who was the inventor of the light bulb, was the first person to refer to little faults and difficulties as bugs, way back in 1878. He mentioned this in a letter to an associate, which was exactly as follows:-
It has been just so in all of my inventions. The first step is intuition and comes with a burst, then difficulties arise—this thing gives out and [it is] then that “Bugs”—as such little faults and difficulties are called—show themselves and months of intense watching, study and labor are requisite before commercial success or failure is certainly reached.
After that many people associated with the technical and engineering field, the errors and glitches were sometimes referred to as bugs.
But on 9th September 1945, a real bug changed the scenario completely. Some operators from Harvard University found an actual bug, a moth, that was lingering in the internals of a “The Mark II Aiken Relay Calculator“, one of the most advanced and sophisticated computers of that period and was used by the US Navy. But one day, it started giving wrong results, whenever any calculations were made through it. Due to the moth, the Mark II malfunctioned. Grace Hopper, the lead scientist of the project, searched hard for the problem and was very surprised to find the moth. She and her fellow operators found it extremely funny to see & find and make a note of the computer bug. They even referred to the removal of the bug as debugging.
Grace Hope, who is credited with the invention of the first compiler for a computer programming language, was also credited for the coining the term bug and debug for computers. In her words, she noted – “From then on, when anything went wrong with the computer, we said it had bugs in it.” She even taped the moth to her logbook from that day with the entry “First actual case of bug being found”, and interestingly that log book is still a part of the collections of the Smithsonian National Museum of American History.
Reference: