A bug may be define as coding error that causes an unexpected defect or fault in a software. Software can become unstable or unusable because of Bug, The affect of some bugs does not seen at the initial development state of software they come up in some specific circumstances.
There may be bugs in software due to Programming error, Communication gap, Documentation Errors, Software complexity, change in requirements Etc..
The Basic or you can say a fundamental error Occur in the software because of programming mistake.
UI Interfaces, Database management, Designing and re-designing will add the complexity to software which leads it to Bugs.
The Changing in software requirement create lot of confusion in the development and testing team. Often, when a new feature added or existing feature is removed from the module which is linked with other module in the software can causes bugs to.
Because of Communication gap there are unclear Software requirements Like what software should do or should not do? which also leads software to bugs.
Most of the bugs occur when the software deadline approaches closer and the programmers are in rush to complete the software.