Let $G$ be a group s.t. $G=Z(G)G'$. When $G$ is abelian or perfect, the above equality is trivially true. We can also construct an example like $\mathbb{Z}_3 \times A_5$ i.e. a product of abelian and perfect groups. I also regard such examples as trivial.
Are there any nontrivial examples or any word to say about such groups?
Let us a call $G$ a Mesel-group if it satisfies $G=G'Z(G)$. Recall that a group is called perfect if it equals its commutator subgroup.
Theorem 1 A group $G$ is a Mesel-group if and only if $G/Z(G)$ is perfect.
Proof This follows from the fact that $(G/Z(G))'=G'Z(G)/Z(G)$.
Theorem 2 Let $G$ be a Mesel-group, then
(a) $G'$ is perfect.
(b) $G/Z(G)\cong G'/Z(G').$
Proof (a) Observe that $[G,G]=[G'Z(G),G'Z(G)]=[G',G']=G''$.
(b) We claim that $Z(G')=G' \cap Z(G)$: it is obvious that $G' \cap Z(G) \subseteq Z(G')$. Conversely, let $y \in Z(G')$, and $g \in G$, say $g=xz$, with $x \in G'$ and $z \in Z(G)$, then $y$ commutes with $x$ and commutes with $z$, so $[y,g]=1$. Hence, $y \in Z(G)$. It follows that $G/Z(G)=G'Z(G)/Z(G) \cong G'/(G' \cap Z(G))=G'/Z(G').$
We now see that the class of Mesel-groups is rather large. First of all, from Theorem 2(a) it follows that the solvable Mesel-groups are precisely the abelian groups. So the interesting ones should be non-solvable. Also, from Theorem 1 it follows that direct products of Mesel-groups are again Mesel. Finally we observe that quotients of Mesel-groups are again Mesel. For in general, if $N \unlhd G$, then $(G/N)'=G'N/N$ and in addition, $Z(G)N/N \subseteq Z(G/N)$. So $G/N$ is Mesel, if $G$ is Mesel.