Let $\Omega$ be a compact, Hausdorff, topological space; let $A=C(\Omega)$, the unital, Banach algebra of continuous functions from $\Omega$ to $\mathbb C$; let
$$\text{Inv}(A)=\{f\in A:g(\omega)f(\omega)=f(\omega)g(\omega)=1\text{ for some }g\in A\text{ and every }\omega\in\Omega\};$$
and let $\sigma(f)=\{\lambda\in\mathbb C:\lambda1-f\notin\text{Inv}(A)\}$.
I want to show that $\sigma(f)=f(\Omega)$.
Let $\lambda\notin\sigma(f)$. Then there is $g\in A$ such that $f=\lambda1-1/g$. Hence, $f(\omega)\neq\lambda$ for every $\omega\in\Omega$, so $\lambda\notin f(\Omega)$. Conversely, let $\lambda\notin f(\Omega)$. Then $\lambda-f(\omega)\neq0$ for every $\omega\in\Omega$ and thus has inverse $g=1/(\lambda1-f)\in C(\Omega)$. Hence, $\lambda\notin\sigma(f)$.
I did not use the fact that $\Omega$ is compact and Hausdorff. Why do we need that?
I don't think there's anything wrong with your argument.
It is just that $C(\Omega)$, for non-compact $\Omega$, is not an interesting algebra. In particular, it is not a Banach algebra, not with the natural norm, because you would need your functions to be bounded.
Also, on "arbitrary" $C(\Omega)$, the spectrum becomes uninteresting. For starters, you cannot guarantee that it will be non-empty (any surjective function will have empty spectrum), nor that it will be bounded. So the spectral radius, and its relation to the norm, are completely absent.