They both have utility, but the former is preferred because it’s actually simpler when you are doing a line of best fit. (Doing the calculus with absolute values is messy). It’s also more sensitive to outliers, which is often what people want.
(The average of 2,3, and 10 is 5, the root squared average is 5.3. The average of 2,3,100 is 35. The root squared average is 58.)