How is the formula $\displaystyle 4\pi r^2$derived?

My teacher gave me this explaination, but I didn't get a chance to ask him questions.

$\displaystyle x^2+y^2=r^2$

$\displaystyle y=\sqrt{r^2-x^2}$

Taking the derivative of y

$\displaystyle \int^r_0 2\pi y[1+(\frac {dy} {dx})^2]$

further integration (not typing out the steps)

$\displaystyle 2\pi r^2$

Where do you get $\displaystyle 2\pi$ from? Why do you need to find the length of the curve?