The problem is that images aren't formed by one ray of light, they're formed by countless rays of light!
A "bundle" of light from the sun ("bundle" meaning a ray localized in space but containing many many photons) will hit the surface of a blade of grass, and all the photons will disperse in a diffuse manner in every direction.
So a bundle of light hits a point on the blade of grass and a sphere (or, a half-sphere) of light expands from this point. Imagine that expanding more, and more, until some chunk of that sphere passes through the aperture of the camera.
It's then the job of the lens to take that light (which is hitting the entire surface of the lens at all different angles) and focus it down onto a point on whatever photosensitive surface is inside the camera!
But you can't just magically change the direction of a ray of light, you have to do it by mere mortal means, in the form of a slab of glass. Even simple lenses act in a way that's rather complicated. (All the formulas on the wikipedia page on lenses use something called the paraxial approximation, and aren't 'exact', which is why there are so many exceptions to the equations)
Basically, the answer is that this glass lens which changes the direction of rays of light through mere mortal means, will only focus rays to a point on the photosensitive surface if the rays all originate from a specific distance.
I drew some pictures for this on a different post I made on google+. Imagine the leftmost green line is the blade of grass, the middle green line is the lens, and the photosensitive surface is somewhere to the right. In this first case, the subject is too close and a bundle of light hitting the blade of grass will spread out over the whole photosensitive surface (blurry).
Animated version of the following image

In this case, the blade of grass is far enough away. If you put your photosensitive surface to the right of the lens, where all the rays converge, then your subject would be in-focus. If you put it anywhere else, it would be out of focus and slightly blurry!!!
Animated version of the following image
