Fit a line by making its mistakes small. Each point’s residual is how far the line misses it; square it and you literally get a square. The mean squared error is the average area of those squares, and gradient descent nudges the slope and intercept to shrink it.