If X and Y are equal almost surely, then they have the same distribution, but the reverse direction is not correct

Take $X$ and $Y$ with probabilities $P(X=1)=P(X=2)=P(Y=1)=P(Y=2)=0.5$ and which are independent. Then $$P(X=Y) = P(X=1, Y=1) + P(X=2,Y=2) =\\= P(X=1)P(Y=1)+P(Y=2)P(Y=2)=0.5,$$ meaning that $X=Y$ holds with probability $0.5$, not $1$.


If $X$ is a random variable following uniform $\mathcal U(-1,1)$ distribution, then $X$ and $-X$ are identically distributed, but obviously $X$ and $-X$ are not almost surely equal, in fact $P(X=-X)=0$