Descartes offers three different arguments for the existence of God over the course of the Meditations. The first is an argument for the necessity of God's existence based on the nature of ideas and the content of our concept of God.
His demonstration of God’s existence begins with an analysis of ideas. According to Descartes, it is in the nature of ideas that they receive whatever "objective reality" they possess from something with as much or more objective reality. Descartes argument is this: if an idea contains something that is not in its cause, then it has come from nothing. But nothing comes from nothing. Therefore, the ideas I have cannot contain more perfection (or reality) than their causes. Descartes makes an analogy to pictures for support—a picture can fall short of perfect resemblance to its subject, but it makes no sense to claim that a picture exceeds the reality or perfection of that which it represents (CSM II 27-9).
What exactly he means by objective reality is a little difficult to pin down, and does not become significantly clearer even when he is pressed on the issue in the Objections and Replies that follow the Meditations. As far as I can tell, Descartes seems to subscribe to the notion that there are grades of being; substances have more reality than modes, for instance. This much was a fairly common notion at the time. But what I'm not sure was as common or uncontroversial is his claim that our ideas of substances have more reality than our ideas of modes, and this difference in reality is a causal consequence of the difference in reality of the entities the ideas represent. This undefended claim is necessary for his argument to get off the ground.
So Descartes concludes that any idea he has that has more objective perfection than he possesses cannot have originated within him. Ideas of material things contain nothing so great that they could not originate within him, however. Because so few of our ideas of corporeal things are perceived clearly and distinctly it is difficult for us to judge whether they are representations of real or unreal things, and so it is difficult to say whether they are the true cause of our ideas of them. Even those elements that are clearly and distinctly perceived in our ideas of objects could be supplied by our own minds (CSM II 29-31).
It is only when he comes to the idea of God that Descartes finds an idea that possesses a degree of objective perfection such that it couldn’t have come from within himself. All of the perfections of God that are present in objective reality within the idea of God must have been produced by a cause with as much perfection. It couldn’t be an extension of our idea of finite substance, because there is more reality in an idea of an infinite substance than in an idea of a finite one, and as finite substances we could not be the source of an idea of an infinite substance. Even though the idea we have of God is inadequate, the degree of perfection it possesses is sufficient for me to know I am not the source of it (CSM II 31-2).
There are several points at which this argument is problematic. First, it's not at all clear that even if there exist degrees of reality in the world that this continuum of existence is reflected in our thoughts. What reason do we have for saying that our idea of a unicorn is less real than our idea of a horse? Clearly a horse is real and a unicorn is not, but what sense does it make to say that the ideas we have of them possess different levels of reality? Descartes simply stipulates this continuum of ideas and doesn't offer us any reason why we should accept it.
Second, even if we grant that ideas do display this continuum of being, there is no indication that this variability in reality is isomorphic with the variability of the reality of the entities the ideas represent. He argues only that there must be some cause of the contents of our ideas, but the move to the notion that the objective reality of the contents of our concepts parallels the objective reality of their objects is a sleight of hand. It's certainly conceivable that the contents of our ideas (and thus the differing objective reality) could have come from some other cause than the object they represent.
These two considerations are sufficient to block the argument, but I also want to look more closely at his contention that the idea of God is something that couldn't be a human construction, because this notion recurs in theological arguments from time to time in one form or another. Descartes bases his claim that our idea of God cannot be a construction on the claim that the idea of an infinite substance cannot be an extension of our idea of finite substance; that is, there is no mental operation available to us to build an idea of infinite substance from our ideas of finite substances. In reality however, it seems eminently plausible that just such an operation is available to us.
Take as an example the idea of numerical infinity; we certainly don't have an idea of numerical infinity on the basis of having ever experienced infinite numbers, but we can construct an idea of numerical infinity by repeating a mathematical operation on a number (addition) and recognizing that there is, in principle, no limitation on applying indefinitely. One plus one is two, plus one is three, plus one is four, and so on. We can have an idea that there is no upper limit on numbers because we see that addition can continue indefinitely.
Why couldn't the infinite properties of God be constructions in exactly this way? Our idea of his infinite goodness can be an extension of the notions of goodness we have from our experiences in the world. Similarly with all the other properties of God; the infinity, power, knowledge etc. that we attribute to him could simply be exaggerations of things we experience in the world. Descartes admitted that the idea of God we have is inadequate but claimed that degree perfection they possess shows that cannot be human construction. This however, does not seem to be the case.
Cottingham, J. G., Stoothoff, R., and Murdoch, D. (eds), The Philosophical Writings of Descartes, 2 vols. Cambridge University Press, 1985.