In IT, a bug refers to an error, fault or flaw in any computer program or a hardware system. A bug produces unexpected results or causes a system to behave unexpectedly. In short it is any behavior or result that a program or system gets but it was not designed to do.
It is not clear when the term “bug” was first used to denote faults in something, as even Thomas Edison mentioned it in a letter to an associate that bugs appear later on the invention process and that more time has to be spent fixing it before the product can be made commercial.