Consistently with $\mathsf{ZFC}$ there is a forcing which preserves cardinals but whose square does not always preserve cardinals - that is, some $\mathbb{P}$ such that for every $\mathbb{P}$-generic $G$ we have $Card^{V}=Card^{V[G]}$$\mathrm{Card}^{V}=\mathrm{Card}^{V[G]}$ but for some $\mathbb{P}^2$-generic $H=\langle H_0,H_1\rangle$ we have $Card^{V}\not=Card^{V[H]}$$\mathrm{Card}^{V}\not=\mathrm{Card}^{V[H]}$.
However, the only way I know how to get this is via a bit of a cheat: find two different forcings which are individually "good" but have "bad" product, and then look at their lottery sum. This construction has the drawback that the square of the resulting forcing doesn't always collapse cardinals - we're only guaranteed "bad" behavior in the extension if the two coordinates of our generic lie on different "sides" of the original lottery sum.
I recall$^*$ seeing a stronger example of this phenomenon, but I can't track it down or reconstruct it on my own:
Is it consistent with $\mathsf{ZFC}$ that there is a forcing $\mathbb{P}$ such that $\mathbb{P}$ preserves cardinals but $\Vdash_{\mathbb{P}^2}Card^V\not=Card^{V[\langle H_0,H_1\rangle]}$$\Vdash_{\mathbb{P}^2}\mathrm{Card}^V\not=\mathrm{Card}^{V[\langle H_0,H_1\rangle]}$?
$^*$ActualllyActually my original memory was that even the weaker phenomenon can't happen, but after it was pointed out to me that it can, I now remember differently. I'm sure eventually my memory will have been right. :P