I've used both before, so I might be able to help you.
Note: I own a Canon 400D, and of course I'll try to assimilate you to the canon side, but it's still your choice.
The 400D's user interface is very intuitive, and very similar to their line of compact / prosumer cameras. If you've used a canon compact camera, you'll be right at home with the 400D.
The Nikon D40x interface was.. weird to me. For someone who did photography on a Lumix Compact camera, everything that I didn't want on the interface was there. So it was difficult to control stuff like exposure, or change ISO etc (for ISO change- the Canon 400D has a dedicated button for that selection).
Good points are autofocus on Canon's cameras are done from the body. Nikon's autofocus is done on the lens. That makes Canon win over Nikon for now, since spending 'AF' on every lens that you buy in the future just isn't worth it to me.
400D uses CompactFlash (CF) cards as memory, while D40x uses SD cards.
The Nikons have auto-iso, something that is very useful if you want to shoot in manual modes (like aperture priority / shutter priority) and not want to be burdened with the changing of ISO (sensitivity). Both cameras do auto-iso on the basic 'point and shoot' mode (green rectangle on Canon 400D), but if you're going for a DSLR, point-and-shoot shouldn't exactly be the top priority on your mind. For this, Nikon wins.
I will not go into the technical details of both, since they're already compared to death all over the world. But I'll just tell you one thing, if you're comparing only the 400D vs D40x, I'd say, if you have the money, go down the Canon line. The 400D performs somewhat better and 'easier' for me (personal opinion).
You won't go wrong with either 2, so I'd suggest you hold / test / get a feel for both cameras at the shop (I hope you know which shop to go to: Cathay Photo, MS Color, John 3:16 please).
Hope this helps =) If you have any questions about the 400D you can contact me.