Let $G_1,\dots,G_n$ be groups and let $\pi\in\operatorname{Sym}(n)$. Then the map $$\varphi_\pi:G_1\times\cdots\times G_n\rightarrow G_{\pi^{-1}\space(1)}\times\cdots\times G_{\pi^{-1}\space(n)}$$defined by$$\varphi_\pi(g_1,\dots,g_n)=(g_{\pi^{-1}\space(1)},\dots,g_{\pi^{-1}\space(n)})$$is an isomorphism. Now let $G_1=\cdots=G_n$ and let $G=G_1\times\cdots\times G_n$. Then $\varphi_\pi\in\operatorname{Aut}(G)$. Show that the map $f:\pi\mapsto\varphi_\pi$ is an injective homomorphism of $\operatorname{Sym}(n)$ into $\operatorname{Aut}(G)$. (Abstract Algebra: Dummit & Foote, Direct products, Ex. 7,8)
It is easy to check that $f$ is injective. I have to show that $\varphi_{\pi_1\pi_2}=\varphi_{\pi_1}\circ\varphi_{\pi_2}$. Let $(g_1,\dots,g_n)\in G$ be arbitrary. Then
$\varphi_{\pi_1\pi_2}(g_1,\dots,g_n)=(g_{(\pi_1\pi_2)^{-1}\space (1)},\dots,g_{(\pi_1\pi_2)^{-1}\space (n)})=(g_{\pi_2^{-1}\space\pi_1^{-1}\space (1)},\dots,g_{\pi_2^{-1}\space\pi_1^{-1}\space (n)})\neq(g_{\pi_1^{-1}\space\pi_2^{-1}\space (1)},\dots,g_{\pi_1^{-1}\space\pi_2^{-1}\space (n)})=\varphi_{\pi_1}(g_{\pi_2^{-1}\space(1)},\dots,g_{\pi_2^{-1}\space(n)})=\varphi_{\pi_1}\circ\varphi_{\pi_2}(g_1,\dots,g_n)$
Something must be wrong here. I somehow understand that (cuz the authors say so, and that $(\pi_1\pi_2)^{-1}=\pi_2^{-1}\pi_1^{-1}$) that the $\pi^{-1}$'s in the definition of $\varphi_\pi$ are needed. This corresponds to a left action. If one uses $\pi$'s in place of $\pi^{-1}$'s in the definition then $f$ is not necessarily a homomorphism, where it corresponds to a right action. What's wrong above anyway?
This is a common point of confusion and it's mostly just notational confusion, IMHO.
Look at the definition of $\varphi_\pi$ carefully:
What does this definition say? In words, it says this:
Now let's look at calculation of $\varphi_{\pi_1} \circ \varphi_{\pi_2}$. The first step is easy since it's just a direct transcription of the definition of $\varphi_{\pi_2}$.
$\varphi_{\pi_1} \circ \varphi_{\pi_2}(g_1, \ldots, g_n)$ = $\varphi_{\pi_1} (g_{\pi_2^{-1}(1)}, \ldots, g_{\pi_2^{-1}(n)})$
Now what does the right side of the above equation equal? According to the definition, the $i$th position of the output vector for $\varphi_{\pi_1}$ is the $\pi_1^{-1}(i)$ position of the input vector. But the $j$th position of the input vector is $g_{\pi_2^{-1}(j)}$, so applying this to $j = \pi_1^{-1}(i)$ gives $g_{\pi_2^{-1}(\pi_1^{-1}(i))}$, which agrees with your calculation of $\varphi_{\pi_1 \pi_2}$.
It appears that your error was to think that the definition of $\varphi_{\pi_1}$ says to apply $\pi_1^{-1}$ to the indices of the $g$'s in the input vector. Such a definition wouldn't make sense, if you think about it. That is the error you made when calculating $\varphi_{\pi_1} \circ \varphi_{\pi_2}$.
If this is not clear, try some examples with a specific $n$ and specific numbers for the input vector, rather than generic elements $g_i$ with indices.