Both are excellent guns - the key difference is the grip safety on the XD. The M&P on the other hand has the safety built into the trigger. Your call on that one.
The XD *has* been on the market longer - what bugs there were have been shaken out. Then again, the M&P seems to have no serious vices.
I'll note that I traded my XD in some months ago - not because I didn't like it - I just wasn't carrying it as much as the others - it's *just* a little blocky (like a Glock). I still have my M&P compact.
In retrospect, if I had to choose between the two, I might end up with the XD.
In general I agree with PhilR. - buy the one that fits your hand.