
In 1945, Grace Murray Hopper was working on the Harvard University Mark II Aiken Relay Calculator (a primitive computer). On the 9th of September, 1945, when the machine was experiencing problems, an investigation showed that there was a moth trapped between the points of Relay #70, in Panel F. The operators removed the moth and affixed it to the log. (See the picture above.) The entry reads: "First actual case of bug being found." The word went out that they had "debugged" the machine and the term "debugging a computer program" was born. Although Grace Hopper was always careful to admit that she was not there when it actually happened, it was one of her favorite stories.
http://www.jamesshuggins.com/h/tek1/first_computer_bug.htm