I know there exists a bijective correspondence between affine irreducible hypersurfaces and irreducible polynomials. This correspondence associates to each irreducible hypersurface $X=V(f)\subset\mathbb{A}^n$ the irreducible polynomial $g\in K[x_1,\ldots,x_n]$ such that $f=g^k$ (for some $k$) which is unique up to invertible elements. (The field $K$ must be algebraically closed).
Well, the following example seems to contradict the fact I've just recalled. Take $X=V(f)\subset\mathbb{A}^2_{\mathbb{C}}$, where $f(x,y)=y^2-x^2(x-1)\in\mathbb{C}[x,y]$. Now, $f$ is irreducible but $X$ seems to have two distinct components, one of which is the point $(0,0)$.
Where is the error? Can you help me please?
First let's figure out what the projective closure of the curve looks like. This has homogeneous equation $Y^2 Z = X^3 - X^2 Z$. Crucially, this equation is linear in $Z$: solving for $Z$ we get
$$Z = \frac{X^3}{X^2 + Y^2}$$
from which it follows that
$$(X : Y) \mapsto (X(X^2 + Y^2) : Y (X^2 + Y^2) : X^3)$$
is a rational parameterization of the projective closure of the curve. It is almost, but not quite, an isomorphism: it sends the points $(1 : i)$ and $(1 : -i)$ to the same point $(0 : 0 : 1)$ but away from this point it has inverse given by projection down to the first two coordinates. In other words, over the complex numbers, after adding points at infinity, the curve is topologically a sphere with two points identified (the "kissing banana"). The identified points correspond to the singularity at $(0, 0)$ that is isolated over $\mathbb{R}$: all of the nearby points are being parameterized by points with complex coordinates (even up to scaling).
To figure out what the actual curve looks like we need to remove the points at infinity. These are the points where $Z = 0$ in homogeneous coordinates, so $0 = X^3$ and the only such point is $(0 : 1 : 0)$. Hence the actual curve is topologically a sphere with two points identified and another point missing; in particular, it is connected.