Let $M_1, M_2$ be smooth manifolds. I have defined a map $f: \left( M_1 \times M_1 \right) \times \left( M_2 \times M_2 \right) \rightarrow \left( M_1 \times M_2 \right) \times \left( M_1 \times M_2 \right)$, as
$$f \left( \left( g_1, h_1 \right), \left( g_2, h_2 \right) \right) = \left( \left( g_1, g_2 \right), \left( h_1, h_2 \right) \right).$$
I want to check if $f$ is smooth. Intuitively, I think that it is smooth. Although I do not understand how to plug in the definition of smoothness of maps between manifolds.
I tried using the definition:
Definition: Let $M$ and $N$ be smooth manifolds. A function $f: M \rightarrow N$ is smooth if for each $p \in M$ there are charts $\left( U, \phi \right)$ of $M$ and $\left( V, \psi \right)$ of $N$ such that $p \in U$, $f \left( p \right) \in V$, $f \left( U \right) \subseteq V$, and the map $\psi \circ f \circ \phi^{-1}: \phi \left( U \right) \rightarrow \psi \left( V \right)$ is smooth.
I thought projection maps would help but I am not able to construct the appropriate charts in $\left( M_1 \times M_1 \right) \times \left( M_2 \times M_2 \right)$ and $\left( M_1 \times M_2 \right) \times \left( M_1 \times M_2 \right)$. What is a way to approach this problem?
This is a problem where the following result from [LeeSM] (pp. 36) yields an economical solution:
Since it seems your main concern is getting tripped up with the notation and juggling with projection maps, this answer is meant to detail how one might go about organizing themselves in their solution to this problem. It happens to be the case that you need not even bother with the particulars of the definition of a smooth map, as you can let Proposition 2.12 do the work for you.
Anyway, let $N = (M_1 \times M_1) \times (M_2 \times M_2)$. The codomain in this problem is $(M_1 \times M_2) \times (M_1 \times M_2)$, this is a cross product of two sets of parenthesis, each set with its own two children. Therefore, we will have a total of six projection maps (one for each set of parenthesis, and then a projection map for each child). The notation for our projection maps is based off of the following:
$$\underbrace{(\underbrace{M_1}_{\pi_{11}} \times \underbrace{M_2}_{\pi_{12}})}_{\pi_1} \times \underbrace{(\underbrace{M_1}_{\pi_{21}} \times \underbrace{M_2}_{\pi_{22}})}_{\pi_2}$$
The explicit application of Proposition 2.12 to the map $f$ which you have given is in the following fashion:
Demonstrating that the four child projection maps are smooth fall from the result that the canonical projection map from the Cartesian product of smooth manifolds to one of the factors are smooth, as is discussed in this post.