No. ThisThe answer assumes that the question intends the standard definition of an algebraic set, which is the zero locus inno. $\mathbb{R}^n$ of a set of real polynomials(Although the previous example I gave was bad.)
Let $f(x,y)$$C$ be an irreducible polynomial whose zero locusthe curve $y^2 = x^2 (x-1)(2-x)$, so $C$ is bounded and has two components. For example, takea smooth component with $1 \leq x \leq 2$, and also a node at $y^2 + (x+2)(x+1)(x-1)(x-2)$$(0,0)$. Let $h(x,y)$$M$ be a polynomial which is positive on one componentthe normalization of $C$ and negative on the other; in the example; explicitly, we could take $h(x,y)=x$. Then take $$M = \{ (x,y,z) : f(x,y)=0,\ h(x,y) = z^2 \}.$$$$M = \{ (x,y,z) : z^2 = (x-1)(2-x),\ y=xz \}.$$ Then the projection $M$$M \to C$ is compact and algebraic,$1$-to-$1$ over the smooth component but misses the projectionnode.
However, such examples can only miss a set of lower dimension than $M$ onto, and cannot occur if all connected components of the Zariski closure of $(x,y)$$f(M)$ have the same dimension! This follows from
Bialynicki-Birula, A.; Rosenlicht, M., Injective morphisms of real algebraic varieties, Proc. Am. Math. Soc. 13, 200-plane is only one203 (1962). ZBL0107.14602.
At the start of section 2, they prove the two componentsfollowing result:
Let $V$ and $W$ be real algebraic sets and let $f: V \to W$ be an injective morphism such that $f(V)$ is Zarsiki-dense in $W$. Then $f(V)$ contains a Zariski-open Zariski-dense subset of $W$.
Note that this is very false for $f$ non-injective; consider the map $x \mapsto x^2$ from $\mathbb{R}$ to itself.
In our setting, take $V = M$ and let $W$ be the Zariski-closure of $C$$f(M)$. For simplicity, let $M$ be irreducible, so $W$ will be as well.
Here isBialynicki-Birula and Rosenlicht's result shows that $f(M)$ must contain a drawingZariski-open Zariski-dense subset $U$ of $W$, and thus $W \setminus U$ must be a proper Zariski closed subset of $W$. In particular, $W \setminus U$ must have dimension lower than $\dim W = \dim M$. If we now assume that $W$ is irreducible and all its connected components have the curvesame dimension, then $C$$U$ must be dense in $M$ for the example: analytic topology.
This is why real algebraic geometry mostly studies semialgebraic setsBut, which are defined by polynomial inequalities;also, $f(M)$ is closed in the class of semialgebraic sets ISanalytic topology since $M$ is compact. We have shown that $f(M)$ is closed under projectionfor the analytic topology and contains a dense set (namely $U$) for the analytic topology, so $f(M) = W$.