[proofplan]
We compare $X$ and $Y$ only through their pushforward probability measures on $(\mathbb R,\mathcal B(\mathbb R))$, since the two random variables may be defined on different probability spaces. The hypothesis gives equality of these two measures on every half-line $(-\infty,x]$. We then prove that the class of Borel sets on which the two measures agree is a Dynkin class, and we include the needed Dynkin-class argument showing that equality on the half-line generator forces equality on all Borel sets.
[/proofplan]
[step:Pass from random variables to their pushforward laws]
Define the probability measures $\mu_X:\mathcal B(\mathbb R)\to[0,1]$ and $\mu_Y:\mathcal B(\mathbb R)\to[0,1]$ by
\begin{align*}
\mu_X(A)=\mathbb P_X(X^{-1}(A))
\end{align*}
and
\begin{align*}
\mu_Y(A)=\mathbb P_Y(Y^{-1}(A))
\end{align*}
for every $A\in\mathcal B(\mathbb R)$. These are the distributions, or laws, of $X$ and $Y$.
For each $x\in\mathbb R$, define the Borel half-line $H_x:=(-\infty,x]$. Since
\begin{align*}
X^{-1}(H_x)=\{\omega\in\Omega_X:X(\omega)\le x\}
\end{align*}
and
\begin{align*}
Y^{-1}(H_x)=\{\omega\in\Omega_Y:Y(\omega)\le x\},
\end{align*}
the hypothesis $F_X(x)=F_Y(x)$ gives
\begin{align*}
\mu_X(H_x)=F_X(x)=F_Y(x)=\mu_Y(H_x)
\end{align*}
for every $x\in\mathbb R$.
[/step]
[step:Show that the agreement class is a Dynkin class]
Let $\mathcal D$ be the class of Borel sets on which the two laws agree:
\begin{align*}
\mathcal D:=\{A\in\mathcal B(\mathbb R):\mu_X(A)=\mu_Y(A)\}.
\end{align*}
Then $\mathbb R\in\mathcal D$, because $\mu_X(\mathbb R)=1=\mu_Y(\mathbb R)$.
If $A\in\mathcal D$, then $A^c\in\mathcal B(\mathbb R)$ and, using finite additivity for probability measures,
\begin{align*}
\mu_X(A^c)=1-\mu_X(A)=1-\mu_Y(A)=\mu_Y(A^c).
\end{align*}
Thus $A^c\in\mathcal D$.
If $(A_n)_{n\in\mathbb N}$ is a pairwise disjoint sequence in $\mathcal D$, then $\bigcup_{n=1}^{\infty}A_n\in\mathcal B(\mathbb R)$ and countable additivity gives
\begin{align*}
\mu_X\left(\bigcup_{n=1}^{\infty}A_n\right)=\sum_{n=1}^{\infty}\mu_X(A_n)=\sum_{n=1}^{\infty}\mu_Y(A_n)=\mu_Y\left(\bigcup_{n=1}^{\infty}A_n\right).
\end{align*}
Hence $\bigcup_{n=1}^{\infty}A_n\in\mathcal D$. Therefore $\mathcal D$ is a Dynkin class.
[/step]
[step:Verify that the half-lines generate the Borel sigma algebra]
Let
\begin{align*}
\mathcal P:=\{H_x:x\in\mathbb R\}.
\end{align*}
The class $\mathcal P$ is a $\pi$-system: for $x,y\in\mathbb R$,
\begin{align*}
H_x\cap H_y=H_{\min\{x,y\}}\in\mathcal P.
\end{align*}
We also have $\sigma(\mathcal P)=\mathcal B(\mathbb R)$. First, each $H_x$ is closed in $\mathbb R$, so $H_x\in\mathcal B(\mathbb R)$ and therefore $\sigma(\mathcal P)\subset\mathcal B(\mathbb R)$. Conversely, for $b\in\mathbb R$,
\begin{align*}
(-\infty,b)=\bigcup_{n=1}^{\infty}H_{b-1/n},
\end{align*}
so $(-\infty,b)\in\sigma(\mathcal P)$. For $a<b$,
\begin{align*}
(a,b)=(-\infty,b)\cap H_a^c,
\end{align*}
so every bounded open interval belongs to $\sigma(\mathcal P)$. Every open subset of $\mathbb R$ is a countable union of bounded open intervals with rational endpoints contained in it, hence every open subset of $\mathbb R$ belongs to $\sigma(\mathcal P)$. Since $\mathcal B(\mathbb R)$ is the sigma algebra generated by the open subsets of $\mathbb R$, this proves $\mathcal B(\mathbb R)\subset\sigma(\mathcal P)$.
[/step]
[step:Run the Dynkin class argument from the half-line generator]
We prove that any Dynkin class containing a $\pi$-system contains the sigma algebra generated by that $\pi$-system, and then apply this to $\mathcal P\subset\mathcal D$.
Let $\mathcal L$ denote the intersection of all Dynkin classes on $\mathbb R$ that contain $\mathcal P$. Then $\mathcal L$ is itself a Dynkin class, $\mathcal P\subset\mathcal L$, and $\mathcal L\subset\mathcal D$ because $\mathcal D$ is a Dynkin class containing $\mathcal P$.
We first show that $\mathcal L$ is closed under intersections. Fix $E\in\mathcal P$ and define
\begin{align*}
\mathcal L_E:=\{A\in\mathcal L:A\cap E\in\mathcal L\}.
\end{align*}
Because $\mathcal P$ is a $\pi$-system, if $P\in\mathcal P$, then $P\cap E\in\mathcal P\subset\mathcal L$; hence $\mathcal P\subset\mathcal L_E$. We verify that $\mathcal L_E$ is a Dynkin class. First, $\mathbb R\in\mathcal L_E$ because $\mathbb R\cap E=E\in\mathcal P\subset\mathcal L$. If $A\in\mathcal L_E$, then $A\cap E\in\mathcal L$. Since $E\in\mathcal L$ and $A\cap E\subset E$, the sets $A\cap E$ and $E\setminus(A\cap E)$ are disjoint and their union is $E$. Closure of the Dynkin class $\mathcal L$ under complements in $\mathbb R$ and under countable disjoint unions implies closure under differences $F\setminus G$ whenever $G,F\in\mathcal L$ and $G\subset F$; applying this with $G=A\cap E$ and $F=E$ gives
\begin{align*}
A^c\cap E=E\setminus(A\cap E)\in\mathcal L.
\end{align*}
Thus $A^c\in\mathcal L_E$. If $(A_n)_{n\in\mathbb N}$ is pairwise disjoint in $\mathcal L_E$, then $(A_n\cap E)_{n\in\mathbb N}$ is pairwise disjoint in $\mathcal L$, and distributivity gives
\begin{align*}
\left(\bigcup_{n=1}^{\infty}A_n\right)\cap E=\bigcup_{n=1}^{\infty}(A_n\cap E).
\end{align*}
The Dynkin property of $\mathcal L$ gives $\bigcup_{n=1}^{\infty}(A_n\cap E)\in\mathcal L$, so $\bigcup_{n=1}^{\infty}A_n\in\mathcal L_E$. Therefore $\mathcal L_E$ is a Dynkin class. By the minimality of $\mathcal L$, we have $\mathcal L\subset\mathcal L_E$. Therefore $A\cap E\in\mathcal L$ for every $A\in\mathcal L$ and every $E\in\mathcal P$.
Now fix $A\in\mathcal L$ and define
\begin{align*}
\mathcal L_A:=\{B\in\mathcal L:A\cap B\in\mathcal L\}.
\end{align*}
The previous paragraph gives $\mathcal P\subset\mathcal L_A$. We verify directly that $\mathcal L_A$ is a Dynkin class. First, $\mathbb R\in\mathcal L_A$ because $A\cap\mathbb R=A\in\mathcal L$. If $B\in\mathcal L_A$, then $A\cap B\in\mathcal L$. Since $A\in\mathcal L$ and $A\cap B\subset A$, the relative-difference property for included members of a Dynkin class gives
\begin{align*}
A\cap B^c=A\setminus(A\cap B)\in\mathcal L.
\end{align*}
Thus $B^c\in\mathcal L_A$. If $(B_n)_{n\in\mathbb N}$ is pairwise disjoint in $\mathcal L_A$, then $(A\cap B_n)_{n\in\mathbb N}$ is pairwise disjoint in $\mathcal L$, and
\begin{align*}
A\cap\left(\bigcup_{n=1}^{\infty}B_n\right)=\bigcup_{n=1}^{\infty}(A\cap B_n).
\end{align*}
The Dynkin property of $\mathcal L$ gives the right-hand side in $\mathcal L$, so $\bigcup_{n=1}^{\infty}B_n\in\mathcal L_A$. Therefore $\mathcal L_A$ is a Dynkin class. Hence $\mathcal L\subset\mathcal L_A$, so $A\cap B\in\mathcal L$ for all $A,B\in\mathcal L$. Thus $\mathcal L$ is both a Dynkin class and a $\pi$-system.
Since $\mathcal L$ is closed under complements and finite intersections, it is closed under finite unions. If $(A_n)_{n\in\mathbb N}$ is any sequence in $\mathcal L$, define
\begin{align*}
B_1:=A_1
\end{align*}
and, for $n\ge 2$,
\begin{align*}
B_n:=A_n\cap\left(\bigcup_{k=1}^{n-1}A_k\right)^c.
\end{align*}
Each $B_n$ belongs to $\mathcal L$, the sets $(B_n)_{n\in\mathbb N}$ are pairwise disjoint, and
\begin{align*}
\bigcup_{n=1}^{\infty}A_n=\bigcup_{n=1}^{\infty}B_n.
\end{align*}
The Dynkin property gives $\bigcup_{n=1}^{\infty}A_n\in\mathcal L$. Hence $\mathcal L$ is a sigma algebra. Therefore $\sigma(\mathcal P)\subset\mathcal L\subset\mathcal D$.
[guided]
The purpose of this step is to justify the extension from half-lines to all Borel sets without assuming that a Dynkin class is automatically a sigma algebra. A Dynkin class has closure under complements and countable disjoint unions, but a sigma algebra needs closure under arbitrary countable unions. The extra input that makes the upgrade possible is that the generating family $\mathcal P$ is a $\pi$-system.
Let $\mathcal L$ be the smallest Dynkin class containing $\mathcal P$, defined as the intersection of all Dynkin classes on $\mathbb R$ that contain $\mathcal P$. This definition is legitimate because the power set of $\mathbb R$ is one such Dynkin class. Also, since $\mathcal D$ is a Dynkin class containing $\mathcal P$, minimality gives $\mathcal L\subset\mathcal D$. Thus it is enough to prove that $\mathcal L$ contains $\sigma(\mathcal P)$.
The first task is to prove that $\mathcal L$ is closed under intersections. Fix a half-line $E\in\mathcal P$ and consider
\begin{align*}
\mathcal L_E:=\{A\in\mathcal L:A\cap E\in\mathcal L\}.
\end{align*}
This class records which sets in $\mathcal L$ have an intersection with $E$ that remains in $\mathcal L$. Since $\mathcal P$ is a $\pi$-system, whenever $P\in\mathcal P$ we have $P\cap E\in\mathcal P\subset\mathcal L$. Hence $\mathcal P\subset\mathcal L_E$.
We check that $\mathcal L_E$ is a Dynkin class. First, $\mathbb R\in\mathcal L_E$ because $\mathbb R\cap E=E\in\mathcal P\subset\mathcal L$. If $A\in\mathcal L_E$, then $A\cap E\in\mathcal L$. Since $E\in\mathcal L$ and $\mathcal L$ is a Dynkin class, the relative difference
\begin{align*}
E\setminus(A\cap E)=E\cap A^c=A^c\cap E
\end{align*}
belongs to $\mathcal L$; here the relative difference is obtained from complements and disjoint decomposition inside the Dynkin class. Therefore $A^c\in\mathcal L_E$. If $(A_n)_{n\in\mathbb N}$ is pairwise disjoint in $\mathcal L_E$, then the sets $(A_n\cap E)_{n\in\mathbb N}$ are pairwise disjoint in $\mathcal L$, and
\begin{align*}
\left(\bigcup_{n=1}^{\infty}A_n\right)\cap E=\bigcup_{n=1}^{\infty}(A_n\cap E).
\end{align*}
The Dynkin property of $\mathcal L$ gives this union in $\mathcal L$, so $\bigcup_{n=1}^{\infty}A_n\in\mathcal L_E$. Thus $\mathcal L_E$ is a Dynkin class containing $\mathcal P$. By minimality of $\mathcal L$, we get $\mathcal L\subset\mathcal L_E$. Hence $A\cap E\in\mathcal L$ for every $A\in\mathcal L$ and every $E\in\mathcal P$.
Now repeat the same idea with the first factor no longer restricted to $\mathcal P$. Fix $A\in\mathcal L$ and define
\begin{align*}
\mathcal L_A:=\{B\in\mathcal L:A\cap B\in\mathcal L\}.
\end{align*}
The result of the previous paragraph says precisely that $\mathcal P\subset\mathcal L_A$. We now verify that $\mathcal L_A$ is a Dynkin class without appealing to repetition. First, $\mathbb R\in\mathcal L_A$ because $A\cap\mathbb R=A\in\mathcal L$. Next suppose $B\in\mathcal L_A$. Then $A\cap B\in\mathcal L$, and also $A\in\mathcal L$. Because $A\cap B\subset A$, the same included-set difference argument used above gives
\begin{align*}
A\cap B^c=A\setminus(A\cap B)\in\mathcal L.
\end{align*}
Thus $B^c\in\mathcal L_A$. Finally, if $(B_n)_{n\in\mathbb N}$ is pairwise disjoint in $\mathcal L_A$, then the sets $(A\cap B_n)_{n\in\mathbb N}$ are pairwise disjoint members of $\mathcal L$, and distributivity gives
\begin{align*}
A\cap\left(\bigcup_{n=1}^{\infty}B_n\right)=\bigcup_{n=1}^{\infty}(A\cap B_n).
\end{align*}
Closure of $\mathcal L$ under countable disjoint unions puts this set in $\mathcal L$, so $\bigcup_{n=1}^{\infty}B_n\in\mathcal L_A$. Hence $\mathcal L_A$ is a Dynkin class. Minimality again gives $\mathcal L\subset\mathcal L_A$. Therefore $A\cap B\in\mathcal L$ for every $A,B\in\mathcal L$.
We have proved that $\mathcal L$ is a Dynkin class closed under finite intersections. This makes $\mathcal L$ a sigma algebra. Indeed, finite unions follow from complements and intersections:
\begin{align*}
A\cup B=(A^c\cap B^c)^c.
\end{align*}
For an arbitrary sequence $(A_n)_{n\in\mathbb N}$ in $\mathcal L$, define disjoint pieces by
\begin{align*}
B_1:=A_1
\end{align*}
and, for $n\ge 2$,
\begin{align*}
B_n:=A_n\cap\left(\bigcup_{k=1}^{n-1}A_k\right)^c.
\end{align*}
Finite-union closure and complement closure give $B_n\in\mathcal L$ for every $n$. The sets $B_n$ are pairwise disjoint, and their union equals the union of the original $A_n$:
\begin{align*}
\bigcup_{n=1}^{\infty}B_n=\bigcup_{n=1}^{\infty}A_n.
\end{align*}
Since $\mathcal L$ is a Dynkin class, it contains this countable disjoint union. Thus $\mathcal L$ is closed under arbitrary countable unions and is a sigma algebra. Because it contains $\mathcal P$, it contains $\sigma(\mathcal P)$. Combining this with $\mathcal L\subset\mathcal D$ gives $\sigma(\mathcal P)\subset\mathcal D$.
[/guided]
[/step]
[step:Conclude equality on every Borel set]
From the first step, $\mathcal P\subset\mathcal D$. From the generator computation, $\sigma(\mathcal P)=\mathcal B(\mathbb R)$. From the Dynkin class argument,
\begin{align*}
\mathcal B(\mathbb R)=\sigma(\mathcal P)\subset\mathcal D.
\end{align*}
Therefore, for every $A\in\mathcal B(\mathbb R)$,
\begin{align*}
\mu_X(A)=\mu_Y(A).
\end{align*}
By the definitions of $\mu_X$ and $\mu_Y$, this is exactly
\begin{align*}
\mathbb P_X(X^{-1}(A))=\mathbb P_Y(Y^{-1}(A)).
\end{align*}
Hence $X$ and $Y$ have the same distribution.
[/step]