Suppose we have a map $f:X\to Y$ and we form the mapping cylinder $M_f$. Hatcher claims that it is obvious that the pair $(M_f, X \cup Y)$ satisfies the homotopy extension property. Equivalently we could find a retraction of $M_f \times I$ to $M_f\times \{0} \cup (X \cup Y)\times I$. I don't see how we can get this latter result, however.

Neil has given an explicit retraction. But it may be useful to note that you can obtain results like this from a combination of some "easier" facts:
(I'll leave the proofs of these as an exercise; you only need the second one for $(L,K)=(I,\{0,1\})$ anyway.) Then note that $M_f$ can be obtained from $X\amalg Y$ by gluing it to a copy of $X\times I$ along $X\times \{0,1\}$. 


I'll assume you want the convention where $M_f$ is $(X\times I)\cup Y$ with $(x,0)$ attached to $f(x)$. Now $M_f\times I=(X\times I^2)\cup(Y\times I)$ with $(x,0,t)$ attached to $(f(x),t)$. We want to retract this onto the space
$$ Q=(M_f\times\{0\})\cup(((X\times\{1\})\cup Y)\times I) $$
Note that $X\times\{0\}\times I$ gets identified with part of $Y\times I$ and so is contained in $Q$. Thus $Q=(X\times U)\cup(Y\times I)$, where 


This question is answered by Chapter 7 "Cofibrations", Example 2 on p. 280 of my book `Topology and groupoids' with full proof. In fact it was in the first (1968) edition of this book, published by McGraw Hill. Other things in that Chapter are a gluing theorem for homotopy equivalences, the exact sequence of a fibration of groupoids, .... In other Chapters you will find the PhragmenBrouwer property, the Jordan Curve Theorem, covering morphisms of groupoids, the fundamental groupoid of an orbit space, ... 

