Let $\mathcal C,\mathcal D$ be categories. A contravariant functor from $\mathcal C$ to $\mathcal D$ is a functor $F$ from $\mathcal C^{op}$ to $\mathcal D$ . Another definition is given on Wikipedia: https://en.wikipedia.org/wiki/Functor#Covariance_and_contravariance
Why are they equivalent? Suppose the former definition holds. Every arrow in $\mathcal C^{op}$ is of the form $f^{op}:B\to A$ for some arrow $f:A\to B$ is an arrow in $C$. We have $F(f^{op}): F(B)\to F(A)$, since $F$ is a functor. Also, if $g: B\to C$, then $F(f^{op}\circ g^{op})=F(f^{op})\circ F(g^{op})$. How does it follow that $F(g\circ f)=F(f)\circ F(g)$? The converse isn't clear either...
The reason that $F(g\circ f)=F(f)\circ F(g)$ when viewing a contravariant functor as a functor $\mathcal{C}^{op}\to \mathcal{D}$ is that $f^{op}\circ_{\mathcal{C}^{op}} g^{op}=(g\circ_{\mathcal{C}} f)^{op}$ by the definition of composition in the opposite category. This is because, given two objects of $A,B\in \mathcal{C}$, $$\mathcal{C}^{op}(X,Y)=\mathcal{C}(Y,X)$$ and the composition operation on a pair of homsets $$\mathsf{comp}^{op}:\mathcal{C}^{op}(Y,Z)\times\mathcal{C}^{op}(X,Y)\to \mathcal{C}^{op}(X,Z)$$ is given by $$\mathsf{comp}^{op}=\mathsf{comp}\circ\tau:\mathcal{C}(Z,Y)\times\mathcal{C}(Y,X)\to\mathcal{C}(Z,X)$$ where $\mathsf{comp}$ is $\mathcal{C}$'s original composition operation, and $\tau$ is the twist function taking $(f,g)\mapsto(g,f)$. Again, this has nothing to do with the definition of a functor, this is just from the definition of $\mathcal{C}^{op}$.
So $F(g\circ_{\mathcal C} f)=F(f)\circ F(g)$ and $F(f^{op}\circ_{\mathcal{C}^{op}} g^{op})=F(f^{op})\circ F(g^{op})$ are actually the exact same equation, since $f^{op}=f$, and $g^{op}=g$.