From $f(x)-f(0)=\int_0^xf'(t)dt$, integrate by parts (notice $dt$ not $dx$) to reach $f(x)=f(0)+f'(0)x+\int_0^xf''(t)(x-t)dt$.
Let $u=f'(t)$ and $dv=dt$.
Then, $du=f''(t)dt$ and $v=t$.
Now, $\int_0^xf'(t)dt=tf'(t)|_0^x-\int_0^xtf''(t)dt=xf'(x)-\int_0^xtf''(t)dt$, which is not the desired formula. How should we proceed?
You need to choose a different antiderivative when integrating by parts: $t$ is an antiderivative of $1$, but so is $t-x$. Choosing the latter instead gives $$ f(x)-f(0) = \int_0^x f'(t) \, dt = [(t-x)f'(t)]_0^x - \int_0^x (t-x) f''(t) \, dt = 0+x f'(0) + \int_0^x (x-t)f''(t) \, dt, $$ as required.