What is the commutative analogue of a $C^*$-subalgebra?
Solution 1:
Roughly, the answer will be that closed C*-subalgebras will correspond to quotient spaces (via pull-back of functions). In your example, the quotient map is one which identifies the two points into a single point. I haven't thought through, though, whether this is a completely correct statement as it stands, or whether one has to add additional caveats.
[Added to answer a question in comments:] The idea is that if $X$ surjects onto $Y$ then we get an injection $C_0(Y) \to C_0(X)$, and conversely.
[Additional discussion added after more thought:] Let me say something about the analogous situation in algebraic geometry, where I am more comfortable with the technical issues:
Affine algebraic sets over $\mathbb C$ correspond to finite type reduced $\mathbb C$-algebras. Giving an inclusion $A \hookrightarrow B$ of finite type reduced $\mathbb C$-algebras corresponds to giving a map $X \to Y$ of algebraic sets which is dominant, i.e. the image is dense.
Now in your set-up: if $X \to Y$ is a map of locally compact Hausdorff spaces with dense image, then again the map $C_0(X) \to C_0(Y)$ will be injective; so I might have been too hasty when I asserted that we get a surjective map. On the other hand, perhaps the image of $C_0(X) \to C_0(Y)$ will not be closed in this level of generality; it's a while since I've thought carefully about these sorts of things, so I don't think I can say more right now with any certainty.
In particular, I'm not so used to working in the case of rings without unit, so my suggestion has more chance to be correct in the case when the spaces are compact. So perhaps it would be easiest to think about the case when $X$ and $Y$ are compact first; note then a map with dense image will automatically be surjective, and so this case might be simpler to understand for this reason too. (In fact, thinking about your example of an ideal that you mention in comments, it might be easier to pass to one-point compactifications --- and thus add a unit --- before proceeding. Because indeed I think that in the ideal case, what will happen is that we will get a map from the 1 point compactification of the space to the one point compactification of the open set which crushes the complement of the open set down to the point at infinity, exactly as you suggest in your comment.)