Let $f:X\to Y$ and $g:Y\to Z$ be continuous maps between topological spaces and $\mathscr{H}$ be a presheaf on $Z$. For now, lets define the presheaf inverse image $g^{-1}\mathscr{H}$ as $$\Gamma(V,g^{-1}\mathscr{H}):=\operatorname*{colim}_{g(V)\subset W}\mathscr{H}(W).$$
I want to prove $f^{-1}\circ g^{-1}=(g\circ f)^{-1}$ as functors. In other words, I want to show that $f^{-1}(g^{-1}\mathscr{H})=(g\circ f)^{-1}\mathscr{H}$ and that, if $\varphi:\mathscr{H}_1\to\mathscr{H}_2$ is a morphism of presheaves, $f^{-1}(g^{-1}\varphi)=(g\circ f)^{-1}\varphi$.
As for the first statement, it boils down to proving that $$\operatorname*{colim}_{g(f(U))\subset W}\mathscr{H}(W)=\operatorname*{colim}_{f(U)\subset V}\operatorname*{colim}_{g(V)\subset W}\mathscr{H}(W).$$ I think this follows from the fact that an open set $W\subset Z$ contains $g(f(U))$ if and only if it contains a subset of the form $g(V)$, where $V\subset Y$ is an open set containing $f(U)$. But it is not clear to me.
As for the second statement, I have no idea about how to prove it.


As you correctly pointed out, the first part is indeed a purely topological problem – given $W \supset (g \circ f)(U)$, $V=g^{-1}(W)$ should work. So this means that your colimits are essentially over the same set of indices so they’re canonically equal.
For the second part, you should just note that if $\phi: \mathcal{F} \rightarrow \mathcal{G}$, then $(g^{-1}\phi)(V) : (g^{-1}\mathcal{F})(V) \rightarrow (g^{-1}\mathcal{G})(V)$ is the colimit of the $\phi(W): \mathcal{F}(W) \rightarrow \mathcal{G}(W)$ over the $W \supset g(V)$. Then it really is (admittedly painful) abstract nonsense.