To compute $\,a\bmod b\,$ we can use the (Euclidean) polynomial division algorithm to divide $a$ by $b,\,$ which yields the remainder $ =a\bmod b,\,$ same as for integers.
However here there is a nice optimization that is available. Namely we have $\,b\mid x^3-1\,$ therefore $\,a\bmod b = (a\bmod x^3\!-1)\bmod b.\,$ But computing $\bmod \color{#c00}{x^3\!-1}\,$ is easy since we can use the rewrite rule $\,\color{#c00}{x^3\equiv 1}\,\Rightarrow\, \color{#c00}x^{\color{#c00}3n}\equiv \color{#c00}1^n\equiv 1\,$ to quickly reduce every polynomial to one of degree $\le 2,\,$ e.g. your $\,a = \color{#c00}{x^3}\!+\!x\!+\!2$ $\equiv \color{#c00}1\!+\!x\!+\!2$ $\equiv x\!+\!3.\,$ This is a special case of the method of simpler multiples.