For every curve $C$ of genus $g\geq 5$ that is neither hyperlliptic nor trigonal and that admits no morphism of degree greater than 1 to a curve of positive genus that has general moduli, there exists no such pair $(Y_1,Y_2)$ of distinct linear spaces.
For every point $p$, for every codimension $2$ linear space $Y$ that does not contain $p$, the span of $p$ and $Y$ is a hyperplane. This hyperplane intersects $C$ in only finitely many points. Thus, there are only finitely many secant lines to $C$ that contain $p$ and intersect $Y$. Thus, for $Y_1$ and $Y_2$, there is no point $p$ such that infinitely many secant lines to $C$ contain $p$ and intersect both $Y_1$ and $Y_2$. So if there are infinitely many secant lines that intersect both $Y_1$ and $Y_2$, then for a general $p$ in $C$, there exists at least one such secant line that contains $p$.
For each of the two linear subspaces, consider the corresponding linear projection $$\pi_j: \mathbb{P}^{g-1}\setminus Y_j \to \Pi_j, \ \ j=1,2,$$ where $\Pi_j$ is a copy of $\mathbb{P}^1$. Consider the morphism $$\pi:C\to \Pi_1\times \Pi_2, \ \ \pi(p)=(\pi_1(p),\pi_2(p)).$$ By the previous paragraph, $\pi$ maps $C$ to its image as a morphism of degree $d\geq 2$. The image cycle in $\Pi_1\times\Pi_2$ has bidegree $(2g-2,2g-2)$. By hypothesis, $C$ admits no finite, surjective morphism to a curve of genus $h$ with $1\leq h\leq g-1$. Thus, the image curve must be a genus $0$ curve. Either the image curve is a smooth curve of bidegree $(1,1)$, or it is a singular curve.
If the image curve is a smooth curve, then it is the graph of an isomorphism from $\Pi_1$ to $\Pi_2$. Thus, the associated $2$-dimensional linear systems of canonical divisors on $C$ are equal, i.e., $Y_1$ equals $Y_2$ and the morphism $\pi$ factors through the diagonal.
Edit. Since the curve has general moduli, the gonality of $C$ is $[g/2]+1$. Thus, the image curve either has bidegree $(2,2)$ or $(3,3)$. If the image curve has bidegree $(2,2)$, then projection away from a singular point defines an isomorphism to a plane conic. In other words, $C$ has a theta characteristic $L$ with $h^0(C,L) \geq 2$. This cannot happen if $C$ has general moduli by a Theorem of Montserrat Teixidor, cf. the following MathOverflow answer and reference: Theta characteristics of genus$\geq3$ curve
MR0887499 (88e:14037)
Teixidor i Bigas, Montserrat(E-BARU)
Half-canonical series on algebraic curves.
Trans. Amer. Math. Soc. 302 (1987), no. 1, 99–115.
14H10
http://www.jstor.org/stable/2000899?origin=crossref&seq=1#page_scan_tab_contents
I will have to think further about whether a general curve could have an invertible sheaf $L$ with $L^{\otimes 3}\cong \omega_C$ and $h^0(C,L)\geq 2$, but it seems even less likely than having a theta characteristic with $h^0(C,L)\geq 2$.
Second edit. Emre and Gregor Bruns finished the proof in the comments. Let me just summarize. The normalization $B$ of the image of $\pi$ is a smooth rational curve. For the associated morphism $$\widetilde{\pi}:C\to B,$$ $\widetilde{\pi}^*\mathcal{O}_B(1)$ is an invertible sheaf $\mathcal{L}$ on $C$ that has a basepoint free pencil of sections (defining the morphism to $B\cong \mathbb{P}^1$). The image of $B$ in $\Pi_1\times \pi_2$ is a curve of bidegree $(d_1,d_2)$ for integers $d_1,d_2\geq 0.$ Thus, $L^{\otimes d_j}$ equals $\widetilde{\pi}^*(\text{pr}_j^*\mathcal{O}_{\Pi_j}(1))$. This equals $\pi_j^*\mathcal{O}_{\Pi_j}(1)$, which in turn equals $\omega_C$ since $\pi_j$ is a linear projection of a canonical curve (and the center $Y_j$ of the projection is disjoint from $C$). Since $\mathcal{L}^{\otimes d_1}$ is isomorphic to $\mathcal{L}^{\otimes d_2}$, also $d_1$ equals $d_2$; call this common integer $d$. Since the gonality of a general curve is $[g/2]+1$, also the degree $(2g-2)/d$ of $\mathcal{L}$ is at least $[g/2]+1$. Thus $d$ equals $1,$ $2,$ or $3.$
We want to prove that $d$ equals $1$, for then the pencil of sections of $\omega_C$ coming from $\pi_1$ and $\pi_2$ are both the same: just the pencil of sections coming from $\widetilde{\pi}.$ This implies that the zero loci of those pencils are equal, i.e., $Y_1$ equals $Y_2$. So the strategy is to rule out $d=2$ and $d=3$ by contradiction.
By the theorem of Montserrat Teixidor, for a general curve there is no invertible sheaf $\mathcal{L}$ on $C$ with both $h^0(C,\mathcal{L})\geq 2$ and with $\mathcal{L}^{\otimes 2}\cong \omega_C$, i.e., $\mathcal{L}$ is a theta characteristic. This rules out $d=2$.
Finally, as Gregor Bruns proves, also we cannot have an invertible sheaf $\mathcal{L}$ with both a basepoint free pencil of sections and with $\mathcal{L}^{\otimes 3}\cong \omega_C$ for a curve of general moduli (hyperelliptic curves of genus $g = 3h+1$ do have such linear systems).
Here is my interpretation of Gregor's argument, but I hope that Gregor will correct me if I am wrong. For any invertible sheaf $\mathcal{L}$ on $C$ with a basepoint free pencil of sections, $$\text{span}(s_0,s_1)\subset H^0(C,\mathcal{L}),$$ setting $\mathcal{F}=\omega_C\otimes\mathcal{L}^\vee$, we can apply the Basepoint Free Pencil Trick (p. 126 of Arbarello-Cornalba-Griffiths-Harris) to see that the kernel of the following cup-product pairing equals $H^0(C,\omega_C\otimes (\mathcal{L}^\vee)^{\otimes 2}) \cong H^1(C,\mathcal{L}^{\otimes 2})^\vee$: $$ \text{span}(s_0,s_1)\otimes H^0(C,\omega_C\otimes\mathcal{L}^\vee) \to H^0(C,\omega_C).$$ By the Gieseker-Petri Theorem (which implies smoothness of the parameter spaces of $\mathfrak{g}^r_d$s), for a curve $C$ of general moduli, this map is injective. Thus $H^1(C,\mathcal{L}^{\otimes 2})$ is zero. On the other hand, if $\mathcal{L}^{\otimes 3}\cong \omega_C$, then this group equals $H^1(C,\omega_C\otimes \mathcal{L}^\vee) \cong H^0(C,\mathcal{L})^\vee$, by Serre duality. So the hypothesis that $\mathcal{L}$ has a basepoint free pencil of divisors leads to the contradictory conclusion that $\mathcal{L}$ has only the zero global section. This rules out $d=3$.
Altogether, this proves that for a general canonical curve $C$, there cannot exist infinitely many secant lines to $C$ that intersect both $Y_1$ and $Y_2$ unless $Y_1$ equals $Y_2$.