xcorr() function if for calculating the time cross correlation of time series (Or any indexed signal).
corr() function is all about calculating the correlation of so supposedly 2 random variables.
While the 2 coincide if used correctly and wisely pay attention that they basically normalize differently the operation (Hence you don't get what you expect).
vA = randn([10, 1]);
vB = randn([10, 1]);
xcorr(vA, vB, 0. 'coeff')
A.' * vB / sqrt((vA.' * vA) * (vB.' * vB))
vAA = vA - mean(vA);
vBB = vB - mean(vB);
xcorr(vAA, vBB, 0, 'coeff')
As you can see from the code above what's you missing is that
corr() removes the mean of the data while
corr(vA, vB) is equivalent of
xcorr(vA - mean(vA), vB - mean(vB), 0, 'coeff').