Pick $X$ such that there are path-components $Y\neq Z$, and $y\in Y$, $z\in Z$ with the conditions: $y$ belongs to the interior of $Y$, $Z$ belongs to the interior of $Z$. Clearly $Y$ has non-empty interior, hence $Y$ can't be a singleton (since this would force $X$ to be a singleton, contracting that $X$ is not path-connected). Choose $x\in Y\smallsetminus\{y\}$. Then we can't approach with continuous maps a map mapping $x\mapsto z$ and $y\mapsto y$. Indeed, a map close enough should map $y\mapsto y'$, $x\mapsto z'$ with $y'\in Y$, $z'\in Z$. The image of a path joining $x$ to $y$ would thus join $y'$ to $z'$, contradiction. Now it's easy to find a compact connected subset of the plane with these conditions. For instance, the closure of the graph $W$ of the function $[-1,1]\to [-1,1]$ mapping $x\neq 0$ to $\sin(\pi/x)$, which is connected with 3 path-components (the two connected components of $W$, and the two segments $\{0\}\times [-1,1]$), with $y=(-1,0)$, $z=(1,0)$.