In an answer to another of my questions, Spice the Bird explains that for any monoid $M$, the map $NM\to NK(M)$ is a weak equivalence. Here $N:{\mathsf{Cat}}\to {\mathsf{sSet}}$ is the nerve functor and $K:{\mathsf{Mon}}\to{\mathsf{Grp}}$ is left adjoint to the forgetful functor ${\mathsf{Grp}}\to{\mathsf{Mon}}$. One views the monoid $M$ as a category with one object. The group $K(M)$ is often called the *group completion* of the monoid $M$.

More generally, for which small categories $C$ is the map $NC\to NK(C)$ is a weak equivalence? Here $K:{\mathsf{Cat}}\to{\mathsf{Grpd}}$ is left adjoint to the forgetful functor ${\mathsf{Grpd}}\to{\mathsf{Cat}}$. Similarly we can call the groupoid $K(C)$ the *groupoid completion* of the category $C$.

Since a groupoid is eqvuivalent as categories to a group, hence a necessary condition is that $NC$ is weakly equivalent to a $K(\pi,1)$. However this condition is not sufficient. For a counter example consider the category $C$ that looks like this $\bullet\rightrightarrows \bullet$. Here $NC$ is weakly contractible. On the other hand, the groupoid $K(C)$ is equivalent to the natural numbers ${\mathbb{N}}$ as categories, hence $NK(C)\simeq N{\mathbb{N}}$ which is weakly equivalent to $N{\mathbb{Z}}\simeq S^1$. Since $S^1$ has nontrivial fundamental group, therefore $NK(C)$ cannot be weakly equivalent to $NC$.

P.S. Is there a standard notation for the left adjoint to the forgetful functor ${\mathsf{Grpd}}\to{\mathsf{Cat}}$? I used $K$ to denote this in the above at the risk of confusion with the Grothendieck group or the $K$-theory ring.