Solution:
The path Theseus traces out is a closed, non-self-intersecting path in the plane. Since each move is along a line segment, the path forms the boundary of a polygon in the plane. WLOG this polygon is traversed counterclockwise (i.e. with the interior of the polygon always on Theseus's left); the argument in the clockwise case is analogous, with a sign flip.
Let i=0 correspond to the direction east, i=1 correspond to north, and so forth. For 0≤i≤3 and j=i±1 let Xij be the number of times Theseus switches from going in direction i to going in direction j (where indices are taken mod 4). So, X=X1,2, Y=X2,1. We have the following relations among the Xij:
The sum n=∑Xi,j is the number of vertices of the polygon. The sum of the interior angles of the polygon is thus π(n−2). Each counterclockwise turn contributes 2π, and each clockwise turn contributes 23π to this sum. The number of the former is counted by ∑Xi,i+1, and the latter by ∑Xi+1,i. So, π(n−2)=2π∑Xi,i+1+23π∑Xi+1,i=πn+2π∑(Xi+1,i−Xi,i+1), which gives ∑(Xi,i+1−Xi+1,i)=4.
Finally, observe by starting from the middle of any edge that since we start and end in the same direction, the number of times we turn into direction i must equal the number of times we turn out of it. So Xi,i+1+Xi,i−1=Xi+1,i+Xi−1,i, which rearranges to give Xi,i+1−Xi+1,i=Xi−1,i−Xi−1,i. So 4=∑(Xi,i+1−Xi+1,i)=4(X1,2−X2,1)=4(X−Y).
So X−Y=1 as desired.