The reason is based on trying to get an unbiased estimator of the underlying error variance in the regression. In a simple linear regression with normal error terms it can be shown that:
$$\text{RSS}(\mathbf{x},\mathbf{Y}) \equiv \sum_{i=1}^n (Y_i - \hat{Y}_i) \sim \sigma^2 \cdot \text{Chi-Sq}(df = n-2).$$
That is, under the standard assumption of normally distributed errors, the residual sum-of-squares has a chi-squared distribution with $n-2$ degrees of freedom. (This is called the residual degrees-of-freedom.) One consequence of this distributional result is that the residual sum-of-squares has expected value $\mathbb{E} ( \text{RSS}(\mathbf{x},\mathbf{Y}) ) = \sigma^2 (n-2)$. You can see from this result that the residual sum-of-squares will tend to be larger for larger data sets (i.e., it is an increasing function of $n$) and it is not a useful estimator of the error variance.
Unbiased estimation of the error variance: To get an unbiased estimator of the error variance, we divide by the residual degrees-of-freedom to get the residual mean-square:
$$\text{RMS}(\mathbf{x},\mathbf{Y}) \equiv \frac{\text{RSS}(\mathbf{x},\mathbf{Y})}{n-2} \sim \sigma^2 \cdot \frac{\text{Chi-Sq}(df = n-2)}{n-2}.$$
This statistic has expected value $\mathbb{E} ( \text{RMS}(\mathbf{x},\mathbf{Y}) ) = \sigma^2$, so it gives an unbiased estimator for the error variance in the regression. The corresponding statistic $\text{RME} = \sqrt{\text{RMS}}$ gives an estimator for $\sigma$, which is the standard deviation of the error term. (Note that the latter is not unbiased, since unbiased estimation of the variance leads to biased estimation of the standard deviation.)
Extension to multiple regression: This result is easily extended to multiple regression (with an intercept term and $m$ explanatory variables) where we have:
$$\text{RSS}(\mathbf{x},\mathbf{Y}) \equiv \sum_{i=1}^n (Y_i - \hat{Y}_i) \sim \sigma^2 \cdot \text{Chi-Sq}(df = n-m-1).$$
In this case the regression mean-square (which estimates the error variance) is:
$$\text{RMS}(\mathbf{x},\mathbf{Y}) \equiv \frac{\text{RSS}(\mathbf{x},\mathbf{Y})}{n-m-1} \sim \sigma^2 \cdot \frac{\text{Chi-Sq}(df = n-m-1)}{n-m-1}.$$
Proof of this general distributional result relies on material relating to quadratic forms of normal distributions, which is beyond the level of mathematics that is usually presented in introductory statistics courses. For information on the derivation of these results you can consult an advanced text on linear regression.