In naieve set theory, you quickly run into existence trouble if you try to do meta-things things like take “the set of all sets”. For example, does the set of all sets that don’t contain themselves contain itself? (see, Russell)
On the other hand, people have no trouble casually talking about the “category of all categories”, etc. How do we know there isn’t a contradiction lurking somewhere here – especially since many books define categories in terms of sets?
If you base your mathematics on Set Theory, then you run into the same foundational issues in Category Theory as you do in Set Theory (since Categories will have to be modeled “with” Set Theory in some sense).
You can go the other way, though: you can base your mathematics with Category Theory, and develop the Category of Sets through it, as Lawvere does here. Then your primitive notions, the bedrock of your theory, is not Set Theory but Categories. There are precise ways in which you can talk about “Category of all categories”, analogous to the way in which you can talk about “the class of all sets” if you start with Set Theory instead.
How do we know there are no problems lurking in this viewpoint? Well, we don’t, just like we don’t know that there are no serious problems lurking in Set Theory (e.g., that it is not consistent).