In 1947 computer scientist Grace Hopper found a moth that had been electrocuted inside the Harvard Mark II computer. She wrote in her notebook that it was the "first actual case of a bug being found."
This story, according to Bryan Lunduke, is false. He says the notebook was not Hopper's because the handwriting doesn't look like hers. Also, he says the term "bug" was already in use to describe actual bugs and system errors that caused machine failure:
In fact, here is a quote from Thomas Edison — dated March 3rd, 1878 — where he talks about finding a bug affecting his technology:
"You were partly correct, I did find a 'bug' in my apparatus, but it was not in the telephone proper. It was of the genus 'callbellum.' The insect appears to find conditions for its existence in all call apparatus of telephones" – Edison
Here's Edison's letter. Wow, such penmanship!