As Big Mike noted, most of the difference is in build quality. The 40D is a magnesium framed full size semi-pro camera. It's a tank with some weather sealing (not up to 5D and 1D standards though). The XSi is all plastic and is light weight feeling by comparison.
Image quality is really about the same even though the XSi has a couple more megapixels.
There are some notable differences between the two though:
- 40D 6.5 frames per second burst vs. 3.5 on the XSi
- 40D has better weather sealing (rain, dirt, dust)
- 40D has a bigger and brighter view finder with optional focusing screens
- 40D has a PC sync port for optional external lighting, GPS, and WiFi connectivity
I would take Mikes advice and go play with them both. It's hard to buy something like a camera without having first played with it.
I recently had to decide between a 50D and a D90. I spent over an hour playing with them side by side before deciding on the 50D (to replace my 40D). Here's my post regarding the comparison -
LINK and why I decided on the 50D.