Definition of cartesian product when the index set is finite Let $\{A_j | j\in J\}$ be be a family of sets. By definition, 
$$\prod_{j\in J} A_j = \{f: J \to \cup_{j\in J} A_j | f(j) \in A_j  \}.$$
However, when we are given two sets, say $G,H$, we are not given any index set, what should we supposed to choose as our index set ?
Even we are expected to choose, say $J = \{1,2\}$, then why $G\times H \not = H\times G$ ? I mean after all, $J$ is just a set, so we cannot put any ordering relation on $J$, which means that as long as $f(1) \in G$ and $f(2) \in H$, $f:J \to G \cup H$ is the same, hence we should have 
$$G\times H = H\times G.$$
 A: If, say, $a\in G$, $a\notin H$, $b\in H$ then $(a,b)\in G\times H$ and $(b,a)\notin
H\times G$. Therefore $G\times H\ne H\times G$.
Here we interpret $(a,b)$ as the function with $1\mapsto a$ and $2\mapsto b$,
that is $\{(1,a),(2,b)\}$ as a set of ordered pairs, and similarly for
$(b,a)$.
A: You can take $\{H,G\}$ as your index set; and then the order does indeed no longer matter: a typical element of the product looks like $\bigl\{\langle G,x\rangle,\langle H,y\rangle\bigr\}$, which is equal to $\bigl\{\langle H,y\rangle,\langle G,x\rangle\bigr\}$. 
In the paragraph above is the definition of $\prod\{G,H\}$. If one wants to define $G\times H$ to be $\prod\{G,H\}$ then one will have to accept that $G\times H=H\times G$. Note that if $G=H$ the product reduces to the set $\{\langle G,x\rangle:x\in G\}$, which is not quite what you'd expect.
Using an indexed family (which is necessary if you need to repeat the same set) results in as many products as there are indexings. For example, if you want a product of two copies of $G$ and one of $H$ then you need some kind of indexing: $\{X_1,X_2,X_3\}$, where it matters whether $H=X_1$, $H=X_2$ or $H=X_3$. To all intents and purposes the three products are the same, except as sets.
If you want do define $G\times H$ as the product of an indexed family, say with the canonical indexing set $\{0,1\}$, then set-wise the indexing matters. Property-wise it does not.
