When does it hold that $\int_{0}^{x} fg=\left(\int_{0}^{x} f\right)\left(\int_0^x g\right)$
Solution 1:
For analytic functions, as Ma Ming has pointed out, only the trivial solution is possible. However, there are other functions that work to solve the problem, such as ones based around requiring that, at any point, one of the two integrals on the left must be zero. As such, this pair of continuous functions will satisfy the integral relation:
$$ f(x)=\begin{cases}\sin(x)&0<x<2\pi\\0&\text{otherwise}\end{cases}\\ g(x)=\begin{cases}x-2\pi&x>2\pi\\0&\text{otherwise}\end{cases} $$ This works because $f(x)g(x)=0$ and, for $x\leq2$, $\int_0^x g(x)dx = 0$ and $\int_0^x f(x)g(x)dx = 0$, while for $x>2$, $\int_0^x f(x)dx = 0$ and $\int_0^x f(x)g(x)dx = 0$.
EDIT: Indeed, one can construct everywhere-smooth functions that satisfy the integral relation. Consider the function: $$ k(x)=\begin{cases}e^{-\frac{1}{x(1-x)}}&0<x<1\\0&\text{otherwise}\end{cases} $$ Now, $k(x)$ is everywhere-smooth, infinitely-differentiable at every point. We can use this function to construct some interesting functions satisfying the integral relation. The first thing to note is that $$ \int_0^2 k(x-1)-k(x)dx=0 $$ Now, if we let $\bar x = x-4\lfloor x/4\rfloor$, and take $$ f(x)=\left[k(\bar x-1)-k(\bar x)\right]\times A\\ g(x)=\left[k(\bar x-3)-k(\bar x-2)\right]\times B $$ where $A$ and $B$ are constants, then we have two smooth functions, neither of which is zero on an interval larger than 2, that satisfy the integral relation. More complicated smooth functions can also be created on this basis.
Solution 2:
Differentiating we get $fg=Fg+Gf$, or $ Fg=f(g-G)=F'(g-G)$, or $\frac{F'}{F}=\frac{g}{g-G}$, so $$F=\pm C\exp \int \frac{g}{g-G}.$$ Now insert possible $G$ to see what happens really. As the comment below pointed, $F(0)=0$, so $C=0$, there is no non-trivial solution...