By definition you have covariance(X,X)=variance(X) always,

while covariance(X,Y)=variance(X) can be true since two numbers can be equal

Covariance(X,Y)=E(XY)-X(X)E(Y) while variance(X)=E(X^2)-(EX)^2

let E(X)=0, then E(XY) could be the same as E(X^2) depending on the distribution.

The restriction comes from the Cauchy-Schwartz inequality, staying with mean zero for X and Y, to keep this simple...