I'm new to handguns so had this same decision point. Went to the range and shot a bunch of different .40s that they had, and would advise you do the same and get the one you are comfortable with.
I did a lot of research here and other forums, GlockTalk and HS2000/XDTalk about pros/cons on each, but nothing substituted for shooting them both to determine which one I felt better about.
For me, I ended up with the XD40. I've "modified it" (haha) slightly since purchase with decal grips + the Pachmayer slip-on grip wrap w/finger ridges so it feels even better than the stock gun (my hands get sweaty while shooting, regardless of the gun, and these items help the grip for me, YMMV). I've also just installed a new guide rod/spring recommended on the XD forum, off to the range today to test how that affects the shooting.
As for accuracy (also a haha since I'm new), in the range tests I did, I was equally "bad" with both the Glock and XD, but the XD felt better in my hand. Since purchasing the XD a few weeks ago, my accuracy has improved, and the gun is VERY easy to shoot and shoot decent groups, even for a beginner.
FWIW, I took my wife shooting for the first time and she liked the Glock feel better than my XD, it fit her hands a lot better. So, go try it. IMO you can't go wrong with either gun, they are both great.
As others have pointed out, the XD has the finish issues that the Glock doesn't, and I haven't had mine long enough to see any problems, but that is an issue you should be aware of / take into consideration.