For whatever it is worth, below is an explanation on why I was interested in this equality. Consider a rectangle of size $x \times 1$, where $x < 1$. I was interested in covering this rectangle with squares of maximum size whenever possible (i.e. in a greedy sense).
To start off, we can have $\displaystyle \left \lfloor \frac{1}{x} \right \rfloor$ squares of size $x \times x$. Area covered by these squares is $\displaystyle \left \lfloor \frac{1}{x} \right \rfloor x^2$.
Now we will then be left with a rectangle of size $\left(1 - \left \lfloor \frac1x \right \rfloor x \right) \times x$.
We can now cover this rectangle with squares of size $\left(1 - \left \lfloor \frac1x \right \rfloor x \right) \times \left(1 - \left \lfloor \frac1x \right \rfloor x \right)$.
The number of such squares possible is $\displaystyle \left \lfloor \frac{x}{\left(1 - \left \lfloor \frac1x \right \rfloor x \right)} \right \rfloor$.
The area covered by these squares is now $\displaystyle \left \lfloor \frac{x}{\left(1 - \left \lfloor \frac1x \right \rfloor x \right)} \right \rfloor \left(1 - \left \lfloor \frac1x \right \rfloor x \right)^2$.
And so on.
Hence, at $n^{th}$ stage if the sides are given by $g_{n-1}(x)$ and $g_n(x)$ with $g_n(x) \leq g_{n-1}(x)$, the number of squares with side $g_{n}(x)$ which can be placed in the rectangle of size $g_{n-1}(x) \times g_n(x)$, is given by $\displaystyle \left \lfloor \frac{g_{n-1}(x)}{g_{n}(x)} \right \rfloor$.
These squares cover an area of $\displaystyle \left \lfloor \frac{g_{n-1}(x)}{g_{n}(x)} \right \rfloor g^2_{n}(x)$.
Hence, at the $n^{th}$ stage using squares we cover an area of $\displaystyle \left \lfloor \frac{g_{n-1}(x)}{g_{n}(x)} \right \rfloor g^2_{n}(x)$.
The rectangle at the $(n+1)^{th}$ stage is then given by $g_{n}(x) \times g_{n+1}(x)$ where $g_{n+1}(x)$ is given by $g_{n-1}(x) - \left \lfloor \frac{g_{n-1}(x)}{g_n(x)} \right \rfloor g_n(x)$.
These squares end up covering the entire rectangle and hence the area of all these squares equals the area of the rectangle.
This hence gives us $x = x \times 1 = \sum_{n=1}^{\infty} \left \lfloor \frac{g_{n-1}(x)}{g_{n}(x)} \right \rfloor g^2_{n}(x)$
When I posted this question, I failed to see the simple proof which Srivatsan had.