One of James McAvoy's most memorable roles was as the younger version of Patrick Stewart's Charles Xavier in the X-Men franchise.