\(Đặt:n_{Al}=a\left(mol\right);n_{Mg}=b\left(mol\right)\left(a,b>0\right)\\ PTHH:2Al+6HCl\rightarrow2AlCl_3+3H_2\\ Mg+2HCl\rightarrow MgCl_2+H_2\\ Ta.có.hpt:\left\{{}\begin{matrix}27a+24b=5,1\\22,4.1,5a+22,4b=5,6\end{matrix}\right.\Leftrightarrow\left\{{}\begin{matrix}a=0,1\\b=0,1\end{matrix}\right.\\ \Rightarrow\%m_{Al}=\dfrac{0,1.27}{5,1}.100\%\approx52,941\%\)