Let $X$ be a compact topological space. Let $f:X\to\Bbb R$. Define $G(f)=\{(x,f(x)):\,x\in X\}$.
Prove that if $f$ is a bounded continuous function then $G$ is compact.
Since $\Bbb R$ is Hausdorff then $G(f)$ is closed. Now $G(f)\subset X\times f(X)$ which is compact since $X$ is so. Since every closed subset of a compact space is compact so $G(f)$ is compact.
Is this proof correct? Where is the hypothesis $f$ is bounded needed?
Your proof is fine. The hypothesis "$f$ is bounded" is not needed, but that is fine. It is automatically true, as $f[X]$, being a compact subsets of $\mathbf R$ is bounded for any continuous $f$.