Here is a non-trivial example the comes up in practice:
Whenever $p$ is a prime number, there are two non-abelian groups of order $p^3$:
- the semidirect product of $\mathbb{Z}/p\mathbb{Z}$ acting as $\big(\begin{smallmatrix} 1 & 1 \\. & 1 \end{smallmatrix}\big)$ on $\mathbb{Z}/p\mathbb{Z} \times \mathbb{Z}/p\mathbb{Z}$, and
- the semidirect product of $\mathbb{Z}/p\mathbb{Z}$ acting as $x\mapsto x^{1+p}$ on $\mathbb{Z}/p^2\mathbb{Z}$.
However, when $p=2$ the unthinkable happens: the two groups are both isomorphic to the dihedral group of order 8!
The “dihedral” aspect of the group is mostly the second semi-direct product, with the reflections acting on the group of rotations. However the first is very important as the Sylow 2-subgroup of the simple group GL(3,2) of order 168.
When $p$ is an odd prime, the two groups are very different. The first has exponent $p$ (all elements have order $p$) while the second visibly has an element of order $p^2$.
This sort of behavior is not too uncommon in p-groups of larger order and is one difficulty in “naming” them, even the ones who look like they should have names.
(The other examples given apply equally well as “counterexamples” to the fundamental theorem of arithmetic: $16 = 2 \times 8 = 4 \times 4$, $12 = 4 \times 3 = 6 \times 2$, or even $4=1\times 4 = 2 \times 2$. The example given here is not of this form, as $\mathbb{Z}/p^2\mathbb{Z}$ is not a non-trivial semi-direct product.)