Before Descartes, philosophy of perception was much more straightforward - you either saw something or you didn't.
Descartes noticed how hard it is to differentiate between seeing something in a dream and seeing the same thing in waking life (could give eg here). Our senses can obviously be deceived, so how do we know we're not being deceived all the time? How can we tell when we're dreaming and when we're awake?
He reached his infamous conclusion, arguing that even the most convinced sceptic must be certain of one's own existence as a thinking thing:
"I resolved to pretend that nothing which had ever entered my mind was any more true than the illusions of my dreams. But immediately afterwards I became aware that, while I decided thus to think that everything was false, it followed necessarily that I who thought thus must be something; and observing that this truth, I think, therefore I am, was so certain and so evident that all the most extravagant suppositions of the sceptics were not capable of shaking it, I judged that I could accept it without scruple as the first principle of the philosophy I was seeking" (Discourse on Method, 4:32)
From this platform, he believed it possible to use our clear and distinct ideas to demonstrate the existence of god, to establish the reliability of our reason generally despite the possibility of error, to deduce the essence of body, and to prove that material things do exist.
From the cogito I know that I exist, and since I am not perfect in every way, I cannot have caused myself. So something else must have caused my existence, and no matter what that something is (my parents?), we could ask what caused it to exist. The chain of causes must...