We have by Itô's formula [1; (25.10)] $$X_t=X_0+\int_0^t f'(B_s)\,\mathrm dB_s+\frac 12\int_0^t f''(B_s)\,\mathrm ds.$$ By [1; Satz 25.18], since $\mathsf E\left(\int_0^T f'(B_s)^2\,\mathrm ds\right)<\infty$ for all $T\in[0,\infty[$ (exercise: prove this!), we have that $t\mapsto\int_0^t f'(B_s)\,\mathrm dB_s$ is a continuous martingale on $[0,\infty[$. Therefore, $t\mapsto\int_0^t f''(B_s)\,\mathrm ds$ must also be a continuous martingale on $[0,\infty[$ (exercise: prove this!).
Lemma. The stochastic process $t\mapsto \int_0^t f''(B_s)\,\mathrm ds$ has almost surely finite local variation.
Since a continuous martingale with almost surely finite local variation is almost surely constant ([1; Korollar 21.72]), we may thus conclude with the help of the Lemma that $t\mapsto\int_0^t f''(B_s)\,\mathrm ds$ is constant almost surely. This implies (exercise: state why) that $f''(B_s)=0$ for all $s\in[0,\infty[$ almost surely.
Now conclude that $f''=0$ using continuity of $f''$ and the fact that the support of $B_s$ is $\mathbb R$ for all $s>0$ and thus that $f$ must be an affine function.
Proof of Lemma. Let $T>0$ and $n\in\mathbb N$. For any partition $0=t_0<t_1<\dots<t_n=T$, we have
\begin{equation*}\sum_{k=0}^{n-1} \left\lvert\int_0^{t_{k+1}} f''(B_s)\,\mathrm ds-\int_0^{t_k} f''(B_s)\,\mathrm ds\right\rvert\le\int_0^T\lvert f''(B_s)\rvert\,\mathrm ds\le T\sup_{s\in[0,T]} \lvert f''(B_s)\rvert,\end{equation*} which is almost surely finite. (Furthermore, if $t\mapsto B_t(\omega)$ is continuous for all $\omega\in\Omega$, then the local variation is finite for all $\omega\in\Omega$.) $\square$
Literature
[1] Achim Klenke, Wahrscheinlichkeitstheorie. 3. Auflage. Springer-Verlag Berlin/Heidelberg (2013).