Let $g$, $h \in C^\infty(\mathbb{R})$ be smooth functions on $\mathbb{R}$. Can I now always find $f \in C^\infty(\mathbb{R})$ such that $g^\prime \circ h^\prime - h^\prime \circ g^\prime = f^\prime$ holds?
I don't see how I should define $f$ so that the equation holds. Any help/tips would be appreciated.
If I understand you correctly, your functions $g,h$ have domain and codomain $\mathbb R$.
By the Fundamental Theorem of Calculus, if $\phi: \mathbb R \rightarrow \mathbb R$ is any continuous function, then for example
$$f (x):= \int_0^x \phi(t) dt$$
defines an antiderivative of $\phi$, i.e. $f$ is a function $\mathbb R \rightarrow \mathbb R$ with $f'(x)=\phi(x)$ for all $x$.
Apply this to $\phi= g' \circ h' - h'\circ g'$, which is not only continuous, but actually $C^\infty$ by assumption and standard theorems. Finally note that $f' = \phi$ being $C^\infty$ implies that $f$ is $C^\infty$ as well.