From ex- (“out of, outside of”) + grex (“herd”) + -ius, literally “outside of the herd”.
Practice speaking and memorizing "egregius" and many other words and sentences in Latin.