need example of a 3x3 non-zero matrix B and a polynomial p(x)

For example, start with $x^2- 3x+ 2= (x- 1)(x- 2)= 0$. Any matrix satisfying $A^2- 3A+ 2I= 0$ must have 1 and 2 as eigenvalues. Since you want a 3 by 3 matrix, take either one of those as a "double" eigenvalue and construct a matrix having eigenvalues 1, 1, 2, or 1, 2, 2. And, since you are only asked for a single example, a diagonal matrix is easiest to construct.