In programming, a bug is unintentional/unwanted behavior of a program or algorithm.
The story goes that back when computers were being developed in the 1940’s, computers occupied huge, refrigerated rooms. One day while one of these computers was running, it began to behave sporadically. Perplexed, the engineers began going through all of the hardware to see if they could find a problem. They searched for hours until eventually, they found a bug had been stuck in one of the cable jacks. After removing the bug the computer behaved normally. Ever since, these sporadic errors have been called bugs, and the process of removing them has been called debugging.
Its interesting to note that this process has transferred from its supposed origins as a piece of hardware terminology and is now used primarily for problems with software. My informant also told me that there is some controversy over the origin of this story, however despite this he still strongly believes that this is the true version of the tale. He does not recall where he first heard this story, but I have also been told this exact narrative by my father when I first started studying computer science.