For any $g$ in $\mathbb{Z}/p\mathbb{Z}[x]$ prove that the degree of $f = \gcd(x^p - x, g(x))$ is exactly the number of distinct roots of $g$ in $\mathbb{Z}/p\mathbb{Z}$.
My main problem is that I do not really understand how to approach this problem at all. I am very new to solving proofs and any type of help would be appreciated thank you.
Sometimes, just taking things straightforward can help. You are computing a "greatest common divisor", so understanding the divisors -- that is, the factors -- of $g(x)$ and $x^p - x$ is likely to be very useful, assuming you can say something about them.
So that's a place to start trying to approach the problem.
You might do research: e.g. your textbook might say something about $x^p - x$ or $\gcd(x^p - x, g(x))$ or maybe just about general polynomials over this field that you could use to solve this problem.
There are surely many different places to start. Pick any of them and try to learn more about the problem: maybe you'll see a path to the solution, or maybe just something interesting or useful, or you might go nowhere at all. You won't know until you try, though.
And you can work backwards: knowing what you are supposed to prove, you can guess as to exactly what the divisors of $x^p -x $ should be (if you don't know already and can't figure it out more directly).