A bug is an unexpected and relatively small defect, fault, flaw, or imperfection in an information system or device. These small defects or faults are generally due to human error when writing the source code or in the design of the medium that causes the system or crash or simply not work.
The origin of this term is allegedly from the IBM Mainframe days in the early 1950s when a moth was found dead within the internals of the room sized computer. The “BUG” was what caused the whole system to malfunction in this situation. The rest is history.
Source: NCSD Glossary