Statement about divisors of polynomials and their roots
It's a great thing that you feel curiosity for the reasons of the statements that are taught to you!
For this, you have to know a little bit about long division of polynomials. Just like integers, we can divide polynomials, obtaining a quotient and a remainder. More precisely:
Given any polynomials $f$ and $g$, there exist polynomials $q$ (the quotient) and $r$ (remainder) such that $$f = q\cdot g + r$$ and the degree of $r$ is strictly smaller than the degree of $g$.
Now, try to prove your theorem. At first, assume that $a$ is a root of $f(x)$, set $g(x) = x-a$ and apply long division (I'm sure you can do it). The procedure is below, but try to do it by yourself at first.
If we apply long division, you get $q$ and $r$ such that $f = q\cdot (x-a) + r$ and $r$ has degree $0$ (why?), so $r$ is a constant. Since $f(a)=0$, we got $0=f(a)=q(a)\cdot (a-a) + r = 0 + r = r$, so $r=0$ and therefore $f = q\cdot (x-a)$.
The other direction is even easier: if $f(x) = q(x)\cdot(x-a)$, can you see why $f(a)=0$?
Let $$ f (x)=a_n x^n+... +a_1 x+a_0 $$ Suppose $ f (r)=0$. Hence $$ a_n r^n +... + a_1 r +a_0 =0$$
Then $$ f (x)=a_n x^n + ... + a_1 x + a_0 - ( a_n r^n +... + a_1 r +a_0) $$
since the expression between parentheses is zero.
After reordering,
$$ f (x) = a_n (x^n - r^n) + ... + a_1 ( x-r) $$ Note that $$ b^n - t^n= (b-t)(b^{n-1} + b^{n-2} t+... + b t^{n-2}+ t^{n-1})$$ (you can check it?) Hence $$\begin{align} f (x)&= a_n (x-r)(x^{n-1}+...+r^{n-1})+...+a_1 (x-r)\\&= (x-r)(a_n (x^{n-1}+...+r^{n-1})+...+a_1) \end{align}$$ For example, suppose $$ f (x)= a_2 x^2+a_1 x + a_0 $$ and $ f (r)=0$. Hence $$\begin{align} f (x) &= a_2 x^2 + a_1 x + a_0 - ( a_2 r^2 + a_1 r + a_0)\\&= a_2 (x-r)(x+r)+ a_1 (x-r)\\&= (x-r)(a_2 (x+r)+ a_1) \end{align}$$