Is the complement of an injective continuous map $\mathbb{R}\to \mathbb{R}^2$ with closed image necessarily disconnected?

Here is a proof, which assumes familiarity with Chech cohomology and Alexander duality. For the latter, see A.Dold, "Lectures on Algebraic Topology", formula (8.18): If $X\subset {\mathbb R}^n$ is a closed subset, then $$ \check{H}^{n-i}_c(X)\cong \tilde{H}_{i-1}({\mathbb R}^n -X). $$

Suppose that $f: {\mathbb R}\to {\mathbb R}^n$ is an injective continuous map whose image is closed in ${\mathbb R}^n$. Then the restriction of the Euclidean metric from ${\mathbb R}^n$ to $Z:=f({\mathbb R})$ is complete; in particular, $Z$ (with the subspace topology) is a Baire space.

Define the subsets $A_\pm\subset Z$ consisting of all points $a\in Z$ for which there exists a sequence $t_n\to \pm\infty$ such that $\lim_{i\to\infty}f(t_i)=a$. Set $A= A_- \cup A_+$. Clearly, both $A_+, A_-$ are closed. The subset $A^c:= Z- A$ consists of all points $x=f(t)$ such that for some (equivalently, every) $r>0$, $x$ is an interior point of $f([t-r, t+r])$ in $Z$.

Remark. The earlier version of my answer contained an error: I was assuming that $f([0,\infty))$ is closed which need not be the case. See also an edit at the end of this answer.

Lemma 1. $A\ne Z$.

Proof. If not then for every $i\in {\mathbb N}$, $f([-i,i])$ has empty interior in $X$. Then $Z$ is a union of countably many subsets with empty interior. But $Z$ is a Baire space. A contradiction. qed

I will assume from now on that $A\ne \emptyset$, otherwise $f$ is a proper map and $f({\mathbb R})$ is homeomorphic to the real line. Without loss of generality (by precomposing $f$ with the mat $t\mapsto -t$), we can assume that $A_+\ne \emptyset$.

Lemma 2. If $A_+\ne \emptyset$ then there exists $x=f(t)\in A^c$ and $a=f(t_0)\in A_+$ such that $t > t_0$.

Proof. If $f^{-1}(A_+)$ is unbounded from below, then any $x\in A^c$ will work. If (the closed subset) $f^{-1}(A_+)$ is bounded from below by some $t_0\in {\mathbb R}$ then the subset $f([t_0,\infty))$ is closed in ${\mathbb R}^n$. I will take $t_0$ to be the infimum of $f^{-1}(A_+)$. In particular, $f(t_0)\in A_+$. Now, the same argument as in the proof of Lemma 1 shows that $f([t_0,\infty))$ is not contained in $A_+$. Hence, there exists $t\in (t_0,\infty)$ such that $f(t_0)\notin A_+$. qed

After precomposing $f$ with a translation of ${\mathbb R}$, we may assume that $t_0=0$.

From now on, I will assume that $n=2$, that $A_+\ne \emptyset$, and, moreover, there exists a sequence $t_i\to \infty$ such that $\lim_{i\to\infty}f(t_i)=a=f(0)$. (See above.) Fix a point $b=f(t)\in A^c\subset X=f({\mathbb R}_+)$.

Proposition. $\check{H}^1_c(X)\ne 0$. (Here and in what follows, I use only (co)homology with integer coefficients.)

Proof. I will consider a sequence of locally finite open covers ${\mathcal U}_n$ of $X$ by subsets $U_{k,n}$ such that $$ \lim_{n\to\infty} \sup_{k} diam(U_{k,n})=0 $$ and that for each $n$, ${\mathcal U}_{n+1}$ refines ${\mathcal U}_n$.

Let $N_n$ denote the nerve of ${\mathcal U}_n$ with the vertex $v_{k}$ corresponding to the open set $U_{k,n}$.

Since there exists an interval $I=(t+\delta, t-\delta)\subset {\mathbb R}_+$ such that $f(I)$ is open in $X$, without loss of generality we may assume that for each $n$, $f(t)$ belongs to the intersection $U_{1,n}\cap U_{2,n}$ of some $U_{1,n}, U_{2,n}\in {\mathcal U}_n$ such that, moreover, $$ U_{1,n}\cap U_{2,n} \cap U_{k,n}=\emptyset $$ for all $k\notin \{1, 2\}$. I then define a 1-cocycle $c\in Z^1({\mathcal U}_n)$ by $$ c(U_{1,n}\cap U_{2,n})=1, $$ and $c(U_{j,n}\cap U_{k,n})=0$ otherwise. (Emptyness of the triple intersections above implies that this is indeed a cocycle.) In terms of the nerve $N_n$, the cocycle $c$ is defined by $c([v_1, v_2])=1$ and $0$ for all other edges.

I claim that this cocycle is nontrivial (when $n$ is sufficiently large). I will prove its nontriviality by exhibiting a 1-cycle $\sigma\in Z_1(N_n)$ such that $\langle c, \sigma\rangle =1$. Namely, for each $n$ there exists $y_i=t_i$ such that $f(t_i), a$ belong to a common $U_{k,n}\in {\mathcal U}_n$. By concatenating $f([0, t_i])$ with the line segment $y_i a$ we obtain a (likely nonsimple) loop $\lambda_n$ in ${\mathbb R}^2$. This loop defines a 1-cycle $\sigma$ in $N_n$ as follows. Pick points $s_0=0\le s_1\le s_2\le ... \le s_{p}=t_i$ in $[0, t_i]$ such that for every $j$, $\{f(s_j), f(s_{j+1})\}\subset U_{q_j,n}\in {\mathcal U}_n$. We set $U_{q_p,n}=U_{q_0,n}$. We obtain a simplicial loop $\sigma$ in $N_n$ with the vertices $$ v_{q_0}, v_{q_1},..., v_{q_{p-1}} $$ Moreover, assuming that $$ \max_{j} |s_{j+1}- s_j| $$ is sufficiently small, we achieve that the edge $[v_{1,n}, v_{2,n}]$ appear exactly one in this loop $\sigma$. Hence $\langle c, \sigma\rangle =1$.

By the construction, the natural map $\kappa_n: N_{n+1}\to N_n$ satisfies $$ \kappa_n^*(c_n)= c_{n+1}. $$ Thus, the sequence of 1-cycles $(c_n)$ defines a nonzero element of $$ \lim_{n} H_c^1({\mathcal U}_n)= \check{H}^1_c(X). $$ qed

We can now finish the proof:

Lemma 3. $X=f([0,\infty))$ separates ${\mathbb R}^2$.

Proof. By the Alexander duality, $$ \check{H}^1_c(X)\cong \tilde{H}_0({\mathbb R}^2 -X). $$ Since $\check{H}^1_c(X)\ne 0$, so is $\tilde{H}_0({\mathbb R}^2 -X)$. qed

We now are ready to prove:

Theorem. Suppose that $f: {\mathbb R}\to {\mathbb R}^2$ is a continuous injective map with closed image. Then $Z:=f({\mathbb R})$ separates ${\mathbb R}^2$.

Proof. Define the subset $A=A_+ \cup A_-\subset Z$ as before. Then $A=\emptyset$ iff $f$ is a proper map. In this case, by the Alexander duality, $$ {\mathbb Z}\cong \check{H}^1_c(Z)\cong \tilde{H}_0({\mathbb R}^2 -Z), $$ hence, $Z$ separates ${\mathbb R}^2$. If $A\ne \emptyset$, then, as noted earlier, without loss of generality, we may assume that $A_+\ne \emptyset$. Then Lemma 3 implies that ${\mathbb R}^2- (X=f([0,\infty)))$ is a disjoint union $U\sqcup V$ of two nonempty open subsets. By applying Baire category argument as in Lemma 1, we see that neither $U$ nor $V$ is contained in $Z$. Hence, ${\mathbb R}^2 - Z= (U - Z)\sqcup (V- Z)$ is a disjoint union of two nonempty open subsets and, hence, is not connected. qed

Edit. Although we do not need this, here is an interesting fact about the set $A_+$. Define the subset $J:= {\mathbb R} - f^{-1}(A_+)$. It is easy to construct examples where $J$ is bounded below (using a version of the topologist's sine curve). However, we have:

Lemma 4. $J\subset {\mathbb R}$ is unbounded above.

Proof. The subset $A^c_+:=f(J)\subset Z$ is open, hence, its complement $Z- A^c_+= A_+$ is closed. Assume for a moment that $J$ is bounded above. Then removing $J$ from ${\mathbb R}$ does not affect the accumulation set $A_+$. It follows that each $a\in Z - A^c_+$ equals the limit $$ a=\lim_{t_i\to \infty} f(t_i). $$ Therefore, for every interval $[-n,n]$, the subset $f([-n,n] -J)$ has empty interior in $A_+$. Thus, we obtain a contradiction with the Baire property as in the proof of Lemma 1. qed