TITLE: Why did Voevodsky consider categories "posets in the next dimension", and groupoids the correct generalisation of sets?
QUESTION [63 upvotes]: Earlier today, I stumbled upon this article written by V. Voevodsky about the "philosophy" behind the Univalent Foundations program. I had read it before around the time of his passing, and one passage that I remember vividly is this, for which I have little in the way of rigorous justification:

The greatest roadblock for me was the idea that categories are “sets in the next dimension.” I clearly recall the feeling of a breakthrough that I experienced when I understood that this idea is wrong. Categories are not “sets in the next dimension.” They are “partially ordered sets in the next dimension” and “sets in the next dimension” are groupoids.
— Voevodsky, The Origins and Motivations of Univalent Foundations

If I had to guess, I'd say that the noninvertibility of morphisms in categories corresponds to some form of partial ordering, whereas a groupoid carries no such information since all morphisms are in fact isomorphisms, but surely there's something deeper at play that caused someone like Voevodsky to consider this realisation a "breakthrough" that accompanied a significant "roadblock".

REPLY [40 votes]: The other answers are quite good and nothing is wrong with them, but lest a wrong impression be given (e.g. by the implicit suggestion that the idea of "categories as sets in the next dimension" in early work on higher categories was "wrong"), I want to add that while Voevodsky is of course correct from a certain point of view, there is another valid point of view according to which categories are, indeed, "sets in the next dimension".
The point is that you have to have two orthogonal axes of "dimension".  David Corfield mentioned this briefly in a comment: instead of just $n$-categories, consider $(n,r)$-categories: categories with (potentially) nontrivial $k$-morphisms for $0\le k\le n$, but where all $k$-morphisms are invertible for $k>r$.  Here "0-morphisms" are objects, and it doesn't make sense to ask for them to be invertible, so $r\ge 0$.  Thus for instance:

A (1,1)-category is a 1-category in the usual sense: objects (0-morphisms) and arrows (1-morphisms), not required to be invertible.
A (1,0)-category is a groupoid: objects and arrows, but the arrows are required to be invertible.
A (2,2)-category is a 2-category in the usual sense: objects, arrows, and 2-cells, none required to be invertible.
A (2,1)-category is a 2-category all of whose 2-cells are invertible, but whose 1-morphisms may not be, i.e. a category (perhaps weakly) enriched over groupoids.
A (2,0)-category is a 2-groupoid: a 2-category all of whose 1-morphisms and 2-morphisms are (perhaps weakly) invertible.
An $(\infty,0)$-category is an $\infty$-groupoid: it has cells of all dimension, all invertible.
An $(\infty,1)$-category is what Lurie's school calls an "$\infty$-category": it has morphisms of all dimension, all invertible except the 1-morphisms.
A (0,0)-category is a set: only objects, no invertibility requirements.

Now you might think from the definition of $(n,r)$-category that you would have to have $r\le n$.  But in fact there is a natural way to extend it to the case $r=n+1$.  For when $r\le n$, we can identify $(n,r)$-categories (up to equivalence) as $(n+1,r)$-categories in which any two parallel $(n+1)$-morphisms are equal.  Then we can take the latter when $r=n+1$ as a definition of $(n,n+1)$-category.  This gives:

A (0,1)-category is a 1-category in which any two parallel 1-morphisms are equal, i.e. (up to equivalence) a poset.
A (1,2)-category is a category enriched over posets, or equivalently a 2-category in which all hom-categories are posets.

Now we can see how the "raising dimension" step that Voevodsky was thinking of takes sets to groupoids and posets to categories: just add one to $n$ in $(n,r)$.

$(0,0) \mapsto (1,0)$
$(0,1) \mapsto (1,1)$

But there's another natural "raising dimension" step that does indeed take sets to categories: add one to both $n$ and $r$.

$(0,0) \mapsto (1,1)$

Since in common usage "$n$-category" for $n\ge 1$ refers to an $(n,n)$-category, it is therefore very natural to say that it is sets, i.e. (0,0)-categories, deserve the name "0-categories", whereas posets should be called (0,1)-categories.
So I think Voevodsky's phrasing of his breakthrough may have been a bit too dogmatic.  The point isn't that it's "wrong" to regard categories as sets in the next dimension (or at least a next dimension).  The point is that it's also valid to regard groupoids as sets in the next dimension, and that this latter point of view is extremely fruitful, leading in particular to univalent foundations but also (somewhat independently) to the recent boom in $(\infty,1)$-category and $(\infty,n)$-category theory.