A geometric example would be the notorious ideal $I=(XY,X^2)\subset A=\mathbb C[X,Y]$.
It has height one and is not principal: the closed subscheme $V(I)\subset\operatorname {Spec}(A)=\mathbb A^2_\mathbb C$ is the $X$-axis with some "fuzz" added to the origin, rendering $I$ not radical: $I\subsetneq \sqrt I$.
This explains the phenomenon:
$\bullet $ The height of the ideal $I$ corresponds to the codimension of the subscheme $V(I)$, which is $1$.
That codimension is a rough, purely topological invariant of the subscheme, which doesn't see nor care about the fine points of the schematic structure of $V(I)$, i.e. about the nilpotents in $A/I$.
$\bullet \bullet $ Being principal is a more sensitive invariant of an ideal, which does care about these nilpotents, as demonstrated here.