You are trying to reprove the Pythagorean Theorem. Understanding the connection provides a powerful intuition for understanding ordinary least squares regression and (incidentally) makes short work of the proof.
Let $y$ represent the vector $(y_1, y_2, \ldots, y_n)$, $\mathbf{1}$ the $n$-vector $(1,1,\ldots,1)$, and $x$ the vector $(x_1,x_2, \ldots, x_n)$. Denote by $\hat{y}$ the vector $\hat\beta_0\mathbf{1} + \hat\beta_1 x.$ In this notation the identity (after combining the last two sums) is
$$ ||y-\hat y||^2 = \sum_{i-1}^n (y_i - \hat {\beta_0} - \hat {\beta_1}x_i)^2 = \sum_{i=1}^n y_i^2 - \sum_{i=1}^n\left(\hat {\beta_0} - \hat {\beta_1} x_i\right)y_i = ||y||^2 - \hat y \cdot y.$$
Because $\hat\beta_0$ and $\hat\beta_1$ are formulas for the least-squares coefficients, by definition $y-\hat{y}$ minimizes the squared distance from $y$ to the line generated by $\hat{y}$. Because $y$ and $\hat{y}$ span a space of at most two dimensions, understanding their relationship is a matter of planar Euclidean geometry which is faithfully illustrated with a simple diagram:
The formulae for $\hat\beta_0$ and $\hat\beta_1$ are usually derived by demonstrating the geometrically obvious fact that $y-\hat y$ must be perpendicular to $\hat y$. In terms of vector operations, this means their dot product is zero:
$$\hat y \cdot (y - \hat y) = 0.$$
Expanding this dot product shows it is equivalent to the key relationship
$$||\hat y||^2 = \hat y \cdot \hat y = \hat y \cdot y.$$
Consider the Pythagorean Theorem. In this right triangle it asserts that the square of one leg equals the square of the hypotenuse minus the square of the other leg:
$$||y-\hat y||^2 = ||y||^2 - ||\hat y||^2.$$
The key relationship provides another expression for the last term, yielding
$$||y-\hat y||^2 = ||y||^2 - \hat y \cdot y,$$
which is the desired identity, QED.