There’s really nothing different from solving such problems in $\Bbb Z$.
Using the Euclidean algorithm in its most straightforward form, not trying to be mechanically efficient:
The gcd is in red. Working upwards, and taking advantage of the fact that subtraction in $\Bbb Z_2[x]$ is addition, we have
&=(x+1)^3 f(x)+x^2 g(x)\;.
As Bill Dubuque points out, and as is illustrated for numerical problems in the Wikipedia article on the extended Euclidean algorithm, there are more efficient ways to carry out the computations, but this is perhaps the easiest way to see clearly exactly what is going on.