For some reason I convinced myself that a simplicial set (or maybe I mean directly Kan complex) is homotopy equivalent to the nerve of a groupoid if and only if it has no higher homotopy groups.
Is this true? (it seems like a proof could go through the fact mentioned in the title of my question)
And a related question: can a space with no higher homotopy groups be described (up to homotopy) as a CW complex with only 1-cells? (I expect not, is there a simple counterexample?)
The reason I ask is that it seems to me that CW complexes with only 1-cells seem special, in the sense that they do not have higher homotopy groups (right?) while something like $S^2$ has only 2-cells but has non-vanshing $\pi_3$.
Your first statement is true: there is an equivalence between homotopy 1-types and groupoids, given by taking the fundamental groupoid. (In general, one expects $n$-groupoids to be modeled by homotopy $n$-types).
An easy way to see this is as follows. There is an adjunction between simplicial sets and groupoids, where the left adjoint sends a simplicial set $X_\bullet $ to $\pi_1 X_\bullet$ (the groupoid, not the group) and where the right adjoint sends a groupoid to its nerve. For any simplicial set $X_\bullet$, there is an adjunction map
$$ X_\bullet \to N(\pi_1 X_\bullet)$$ which, roughly speaking, sends each point (vertex) in $X_0$ to the corresponding object in the groupoid, and sends each edge to the morphism in the fundamental groupoid that it determines. This is always an equivalence on $\pi_0$ and $\pi_1$. If there are no higher homotopy groups, it is an equivalence by Whitehead's theorem.
(In response to the title of your question: (nerves of) groupoids can be characterized as those simplicial sets with the unique horn filling property for all horns, just as categories can be characterized as those simplicial sets with the unique horn filling property for inner horns. If you believe the latter statement, it's not too hard to verify the former.)