The biology of a cartoon
XD is a living cartoon, brought to life form nothing but doodles on paper. He is the only one of his kind in a manner of speaking, and has some interesting features and quirks of his body. His body literally generates a sort of cartoon physics field. This results in cartoon physics temporarily "bleeding" into reality, allowing for more than ridiculous feats to be made possible (painting a tunnel that can actually be walked through, defying gravity until looking down etc).
XD himself is a cartoon, an embodiment of these strange rules. Like any cartoon, things that would kill most things are but a laugh for this creature. Getting run over by a train makes him as flat as paper, bullet holes literally leave hollow holes.