$T$ has units of Kelvin (K). The gas constant $R$ has units of Joule/mole/K. The molecular mass $M$ has units of kg/mole. Also remember that a Joule is $\mathrm{kg.m^2/s^2}$. So the units of $3RT/M$ are $$\mathrm{\frac{kg\,m^2\,K}{s^2\,mole\,K\,kg\,mole^{-1}}=\frac{m^2}{s^2}}$$ which is a velocity squared. So taking the square root gives the correct units for a velocity.