I think it is more interesting (and realisitc!) to have the ant crawl on the surface. Then the way to get the answer is to flatten the shape. We need only concern ourselves with the edges of the cubes that are visible in the illustration. There are several combinations of edge cuts that are sufficient to flatten the visible surfaces. For some of the flatten options it is possible to draw a straight line from Y to X. For others, an indented corner gets in the way and it is necessary to go straight to that corner from Y and then continue straight on from there to X. All these options can be calculated using Pythagorean theorem (keeping in mind that, for each step traversed, add one to the "height"). But by examination it is clear that the straight path from X over the first step and on toward the 3-edge about 1.3 of the way up it, which leads directly to X. It length is:

SQRT(7*7+11*11)=13.04...

(Longer, of course, than the tunnel SQRT(4*4+4*4+10*10)=11.49...But probably quicker since ants walk a lot more quickly than they burrow!)