A bug is an error in
coding by the software developer
that causes a program to malfunction or to produce incorrect results.
The origin of the term reputedly goes back to the early days of computing,
when a hardware problem in an electro-mechanical computer at Harvard
University was traced to a moth caught between the contacts of a relay on
the machine. (Entomologists will undoubtedly be quick to note that a moth
is not really a bug).
The above is quoted from the
Computer Dictionary by Microsoft Press.