Stitch, when I first saw your Exif info I thought 1/500 is plenty fast and it should have come out in focus. But, then I looked further and your camera was in Manual focus mode. If you didn't know it was in manual focus mode, that would probably be why the photo is blurred. I've done the same in years past. It's frustrating, but that's how we learn. On my D90 and D80 there is a focus switch. Im not sure if you have a switch or a button on the D40, but anyway, if that switch is set to M then I have to manually focus my lenses. If it's set to A that means the body will autofocus my lens for me.
My Exif reader software says that your exposure setting was undefined, so I don't know what exposure setting you had it set to, but if the camera switch was set to M, that's probably why the photo is blurred. Switching it to M overrides any other setting. So you could have had it in Auto mode, but with the manual focus switch set to M, it told the camera that you will manually focus the lens. You probably thought it was in Autofocus mode (AFA, AFS or AFC) and didn't know that the camera wouldn't Autofocus. In Manual focus mode, the camera will snap a photo of anything whether in focus or not. It's depending on you to tell it what to do. In AF mode, if the camera could not find focus, it would 'hunt' for it and the lens sometimes will zoom in and out, in and out to try to find focus. (Like in a dark ride setting for example.)
I hope this helps you some. Let me know if you have any questions. I'm no expert, but I'll do the best I can to pass along what I know...Hopefully someone else with more experience will chime in here...