Please see the answer of Jesus RS, which includes useful information about the product topology and its relationship to the box topology in general. My answer here is just a requested clarification of an example I suggested as a comment.
Let $X_1$ be the real line $\mathbb{R}$ and $X_2 = S^1$ (under the usual Euclidean metrics). Explicitly, $S^1 = \{z \in \mathbb{C} : \lvert z \rvert = 1\}$. Then let $X = \mathbb{R} \times S^1$ be their Cartesian product, endowed with the product topology (equivalent to the box topology since it's a product of finitely-many spaces, specifically just two spaces).
You can visualize $X$ as a "long cylinder" in 3-dimensional Euclidean space.
Now let $G = \{ 1 \}$ be the subset of $S^1$ that has only a single element, namely the complex number $1 = 1+0i$. Then $G$ is compact (why?), and we look at the projection $\pi_2 : X \to S^1$. The preimage of $G$ under this map is certainly $\mathbb{R} \times G = \mathbb{R} \times \{ 1 \}$, which turns out (under the topology induced as a subspace of the product space $X$) to be homeomorphic to the real line $\mathbb{R}$--see next paragraph if you're not sure about this.
Sketch of proof that $\mathbb{R} \times \{ 1 \}$ is homeomorphic to $\mathbb{R}$: First, the inclusion $\mathbb{R}\times \{ 1 \} \to \mathbb{R} \times S^1$ is continuous (inclusions are always continuous--why?), and you told us that the projection map $\mathbb{R} \times S^1 \to \mathbb{R}$ is continuous, so their composition is a continuous map $f: \mathbb{R}\times \{1 \} \to \mathbb{R}$. This function $f$ is actually quite simple; it's $f(x, 1) = x$. To show that $f$ is a homeomorphism, we'd need to show that $f$ is a bijection (which should now be very simple) and show that $f^{-1}$ is also continuous. This last part basically just requires us to show that for any open set $V \subseteq \mathbb{R}\times \{ 1\}$, the set $f(V)= \{ x : (x,1) \in V \}$ is open in $\mathbb{R}$. $\Box$
But the real line is not compact (show by using the definition of "compact", or recall that compact means closed and bounded in Euclidean space), so you have a counterexample: the preimage of a compact subspace under a projection need not be compact.
Note: it shouldn't be surprising that $\mathbb{R} \times \{ 1 \}$ is homeomorphic to $\mathbb{R}$; indeed it would be shocking if it were anything else. Further, it shouldn't matter if we consider $\mathbb{R} \times \{ 1 \}$ to be a subspace of $\mathbb{R} \times S^1$ or as a product space in its own right...and indeed it doesn't matter at all.
In fact in this example, the circle $S^1$ was irrelevant; you could get the same thing by taking $X_2$ itself to be a single-point space and $G = X_2$, and $X_1$ to be any non-compact space.
This might also be a good time to mention that not all open sets $U$ in the product space $X=X_1 \times X_2$ will be of the form $U_1 \times U_2$ where $U_i$ is open in $X_i$, because you have to also accept any union of such products as open sets. (Think about open sets in $\mathbb{R}$ and open sets in $\mathbb{R}^2 = \mathbb{R} \times \mathbb{R}$.) Rather, such products $U_1 \times U_2$ form what is called a basis for the box topology. It wasn't quite clear from your question if you had noticed this or not, so I thought I'd throw it in.
Further info:
http://en.wikipedia.org/wiki/Product_topology
http://en.wikipedia.org/wiki/Box_topology
Why are box topology and product topology different on infinite products of topological spaces?
Product and Box Topologies