Why is it so that the regression line is horizontal to the x-axis when r-squared = 0?
I do understand that when r-squared = 1, estimated Y and actual Y are equal.
Nonmathematically: R-squared quantifies how well X lets you know Y (given the linear model). If the best-fit line is horizontal, then knowing X doesn't help you even the tiniest bit in knowing Y. Your best prediction for future Y values is the mean of all the current Y values, regardless of X. Since knowing X provides no useful information in predicting future Y values, R-squared is zero.
I calculate R-squared as "1.0 - (absolute_error_variance / dependent_data_variance)", so if all errors are zero (no variance) the R-squared is then "1.0 - (0.0 / dependent_data_variance)", or more simply "1.0 - 0.0". For a horizontal line the error variance equals the dependent data variance, so that would be "(1.0 - 1.0)", or simply 0.0.