If $f$ is finite flat of degree $d$, then $f \times f \colon X \times X \to Y \times Y$ has degree $d^2$, but $\Delta_f \colon \Delta_X \to \Delta_Y$ has degree $d$. So equality cannot hold scheme-theoretically unless $f$ is an isomorphism.

A fairly explicit case is the finite étale Galois case, where $(f \times f)^{-1}(\Delta_Y)$ is the disjoint union of the graphs $\Gamma_\sigma$ of deck transformations $\sigma \colon X \to X$.