I have two related questions which are just making the question asked in the title more specific:
(a) Is every ring homomorphism (or maybe $\mathbb R$-algebra homorphism) between rings of the form $\mathscr C(\mathbb R^n),$ ie. rings of continuous functions on Euclidean spaces, automatically continuous?
(b) Does the obvious functor $\mathbb R^n\mapsto \mathscr C(\mathbb R^n)$ define a fully faithful embedding of the full subcategory of topological spaces spanned by $\mathbb R^n$ for all $n,$ into the category of (if needs be topological, depending on what the answer to (a) is) rings/algebras?
I am aware that the answer to both questions is positive when attention is restricted to smooth functions or, when $n$ is even and we can identify $\mathbb R^n$ with $\mathbb C^{n/2},$ to holomorphic or even regular (in the sense of algebraic geometry) functions. However, it is the continuous case which interests me.
Here are two relevant theorems from Gillman and Jerison, Rings of Continuous Functions, Van Nostrand 1960:
Theorem 8.3. Two realcompact spaces $X$ and $Y$ are homeomorphic if and only if $C(X)$ and $C(Y)$ are isomorphic as rings.
Theorem 10.6. Let $t:C(Y) \to C(X)$ be a ring homomorphism with the property that $t\mathbf{1} = \mathbf{1}$. If $Y$ is realcompact, then there exists a unique continuous mapping $\tau:X \to Y$ such that $tf=f\circ \tau$ for all $f \in C(Y)$.
The definition of realcompactness is a little involved, but every Lindelöf space is realcompact, so all subsets of Euclidean spaces are, too. This shows that the answer to both of your questions is "yes".