I am quoting from MathOverflow, where I have just read it as part of a comment: "If $C$ and $S$ are, resp., a compact and a connected unbounded subset of $\mathbb{R}^d$ such that $C\cap S \ne \emptyset$, then $S$ meets $\textrm{bd}(C)$." As far as I understand, $\textrm{bd}$ means "boundary".
I have my own proof of this, but the statement looks like one of those basic results in topology that you are going to use in a number of situations. So I wonder if anybody could give a reference.
In addition, what about some generalizations?
This is a special case of "you cannot connect the inside to the outside without crossing the boundary". As it is stated in Elementary Topology. Textbook in Problems
Sketch of (my) proof: If $F \cap \operatorname{Fr} A = \emptyset$, then $F \cap \operatorname{Int} F$ and $F \cap \operatorname{Ext} F$ form a separation of $F$.
So in the case you describe the only relevant consequence of the facts that $C$ is compact and $S$ is unbounded, is that $S \not\subset C$. The fact that the space is $\mathbb{R}^n$ is not needed at all.