implicit equation for "double torus" (genus 2 orientable surface)
Here is a general recipe for a polynomial whose level set is an $n$-torus in $\mathbb R^3$.
First, take the polynomial $$\begin{align}f(x) &= \prod_{i=1}^n (x-(i-1))(x-i) \\ &= x(x-1)^2(x-2)^2\cdots(x-(n-1))^2(x-n)\end{align}$$ which is positive as $x\to\pm\infty$, crosses zero at $x=0$ and $x=n$, and touches zero from below at $i = 1, 2, \ldots, n-1$. Examples: $n=1$, $n=2$, $n=5$.
Then let $$g(x,y) = f(x) + y^2,$$ so that the set of points $g(x,y)=0$ forms $n$ connected loops ($n=1$, $n=2$, $n=5$). Finally, define $$h(x,y,z) = g(x,y)^2 + z^2 - r^2,$$ which "inflates" the loops in three dimensions. For small enough $r$, the level set $h(x,y,z) = 0$ is an $n$-torus. For example, here's $n=2$ and $r=0.1$, for which the zero level set of $h(x,y,z) = \left(x(x-1)^2(x-2)+y^2\right)^2+z^2 - 0.01$ is plotted:
Here's another way to obtain a "double torus": you can start from the implicit equation of a lemniscate, which is a curve shaped like a figure-eight. One could, for instance, choose to use the lemniscate of Gerono:
$$x^4-a^2(x^2-y^2)=0$$
or the hyperbolic lemniscate, which is the inverse curve of the hyperbola:
$$(x^2+y^2)^2-a^2x^2+b^2y^2=0$$
(the famous lemniscate of Bernoulli is a special case of this, corresponding to the inversion of an equilateral hyperbola).
Now, to generate a double torus from these lemniscates, if you have the implicit Cartesian equation in the form $F(x,y)=0$, you can perform the "inflation" step of Rahul's approach; that is, form the equation
$$F(x,y)^2+z^2=\varepsilon$$
where $\varepsilon$ is a tiny number.
For instance, here's a double torus formed from the lemniscate of Bernoulli: $$((x^2+y^2)^2-x^2+y^2)^2+z^2=\frac1{100}$$
For surfaces of higher genus, one might want to use sinusoidal spirals instead as the base curve.
Yet another possibility to generate surfaces of genus $n\geq 2$ is to consider the surface $F_1(x,y,z)F_2(x,y,z)\dots F_n(x,y,z)=0$ where the $F_i$ are the implicit Cartesian equations for the usual torus, suitably translated and/or rotated. One can then replace $0$ with a tiny number $\varepsilon$.