A “bug” is an instance whereby something (typically machinery) does not behave as it should. These “bugs” take a variety of forms, including minor inconveniences and faults, not accepting data input (for computing machines), or catastrophic failure.
In the 1940s, as you may already know, computers were much larger and much more temperamental than the devices of today.
While working with the Harvard Mark II, Grace Harper’s operators found that a problem with the Mark II had been traced to a moth that was caught in a relay. From there, the story goes that Hopper said that they were “debugging” the system. The term had already been used in mechanics and computing, but Hopper is anecdotally credited with popularizing the term.
That same moth is on display in the Smithsonian, on the same page it was taped to sixty-six years ago.