We need testing because humans make mistakes. The software development life cycle includes several steps such as specifying requirements, design, development, and delivery. If a mistake occurs in one of these steps, it can lead to mistakes in further steps.
The following diagram shows how mistakes in different steps can impact on the whole process:
As you can see, it's important to detect a bug as soon as possible. There are many different types of testing that can be applied in different cases to recognize a defect as soon as possible.