Algorithms for detecting the difference between two signals
This is a pretty common problem, and you’ll see it all the time in radar/sonar/___ar processing. Cross-correlation is really the thing you’d want to use here in my opinion.

In layman’s terms, you can use cross-correlation to do “template matching”. In radar applications, were looking for the signal we sent out to return to us. Since we know what signal we sent out, we can use that as a template and use cross-correlation as a mathematical tool to “search” for that template signal in the received signal.

So in your problem statement, you have the signal X which and the signal Y. It seems that Y = X + N, where N is some noise signal. To use cross correlation in MATLAB, you can simply just do [xc, lags]=xcorr(Y, X). Now ideally, the peak of the magnitude of xc will tell you precisely where the signal X “starts” in your signal Y. It’s important to note that the output of the MATLAB xcorr function will include “negative” time lags, so when you plot it, use plot(lags, abs(xc)).

If you plotted the magnitude of xc, that is abs(xc), you’ll likely notice a discernible peak above all of the noise. This would tell you that indeed, the signal X is present in the signal Y.

Now that’s just a simple overview of cross-correlation; naturally there are a lot of fine details, but hopefully that should get you started!

Implementation note for cross-correlation: 
If you wanted to do circular cross-correlation or not use any built ins, you could do it with discrete Fourier transforms (DFT/FFT):
xc = IFFT( FFT(Y) .* conj(FFT(X)) ). If you’d like to learn more about the mathematics of this, check out Wikipedia and the convolution theorem.