Oh boy- are you about to get a tirade of "use the search function" posts on this thread.
It's a fair question, and although I went through this yesterday, I really have nothing better to do, so I'll oblige.
As you may know, SLR cameras, and dSLR cameras (like the D40 and D50) have interchangeable lenses. This means that depending on what you're shooting (err, taking pictures of), you can mount the best-suited lens, in order to achieve optimal results.
Now, you're probably looking at all the lenses on B&H or the Nikon site, and saying to yourself, OK, what's the difference. The first thing to learn is that there are "prime" lenses, and there are "zoom" lenses. A prime lens comes at only a fixed zoom, and you cannot...err, zoom with it. The only way to magnify somthing is to physically move closer (not true for macro lenses, but I'm not even going to touch this). A zoom lens, on the other hand, allows you to...err, zoom. Meaning that you can twist a ring, and have the optical elements in the lens decrease your angle of view, thus making far away objects appear closer. Why are there prime lenses then? The theory is that prime lenses are sharper- meaning their edge-to-edge image quality is supperior, though you give up the convenience of a zoom. Prime lenses are also usually "faster" (see below).
Now, given the 2 cameras you have selected, the D40 and D50, one thing you will have to remember is that you will have a 1.5 crop factor, meaning that if you were to get a normal (film) SLR, and use the same lens on both the Nikons and the film cameras, the zoom on the Nikons will be 1.5 times more on the long end. This is due to the sensor (acquisition chip) size, but you shouldn't worry about it; it's just a preface for below.
There are a number of lenses that can be used on an SLR, and, like I said, there are specific uses that go along with those lenses. There are 2 things to consider, when selecting a lens- focal length, and aperture. The focal length, i.e.-the zoom range (or the fixed length of a prime) is the magnification that the particular lens will give you. A 24-70 lens, for example will allow you roughly a 3X zoom. It's important to start thinking about lengths, and not zoom X's. So at 24mm, the lens will be at the "wide end", and at 70, it will be at the tele-end. Similarly, a 70-200 lens, will allow you to zoom from 70 to 200 mm (and everything in between), a 200- 400 lens will be more and more zoom... you get the point. Prime lenses are often used at several lengths- 35mm, 50mm, and 85mm tend to be the holy-trinity, though landscape photographers often use wide-primes- in the 14-35 range, and sports photographers use 200+ primes to capture action from the bleachers.
OK, so the smaller the focal length, the wider your perspective. Now, remember a while back when I said that you are looking at cropped-sensor cameras? Well, this is important in that it will determine the lenses you get. A wide 24mm lens on a Nikon D40 becomes a not so wide 36mm, a 28-70 zoom becomes a 42-105. You gain more telephoto range, but lose the wide-angle with most dSLRs.
Lens speed is determined by the maximum aperture that a lens has (aperture is how wide the little blades in the back of the lens open during an exposure, and determine how much light enters and falls upon your sensor). A lens that has an aperture of 2.8 is faster than one that has an f/4, which, in turn is faster than f/5.6, etc. In photography, the larger f number means smaller aperture. I'd get into what that means, but I don't want to bore you to tears.
Now, you're probably wondering why you'd want to use different apertures. Aside from determining how much light enters the sensor, aperture is also responsible for determining the depth-of-field. This means the area in your picture that is in focus. Wider apertures allow for shallower depts of field, so you can artistically "isolate" and object from the background, while smaller apertures, allow for things in the background to be in focus so you can have a "storytelling" image.
Fast glass is great- allows for faster shutter speeds to be used, and usually produces nicer-looking bokeh- background blur. This is also why they tend to be more expensive, and for the most part, only those interested in going somewhere with their photography would look at them.
I think this covers the basics- you'll probably encounter things like VR in the lens names (stands for vibration reduction), or IS (image stabilization), which is nice feature when you're shooting handheld, and tends to add several hundred dollars to your lens purchase price.
If you want to learn more about the individual lenses, go to
http://www.fredmiranda.com/
Under the reviews, there is an abundance of info about the individual lenses, including links to sample images.
Good Luck.
Alright, that will be $600 for a semester of intro to photography