We have: $$\prod_{i\in I}{X_i}=\left\{f:I\to\bigcup_{i\in I}{X_i}~\Big|~ (\forall i\in I)\big(f(i)\in X_i\big)\right\}$$
Is it true: $$\left|\prod_{i\in I}{X_i^2}\right|=\left|\left(\prod_{i\in I}{X_i}\right)^2\right|$$
and can we assume: $$\prod_{i\in I}{X_i^2}=\left(\prod_{i\in I}{X_i}\right)^2$$
It is not literally true that
$$\prod_{i\in I}{X_i^2}=\left(\prod_{i\in I}{X_i}\right)^2\;:$$
elements of the lefthand side are functions with domain $I$ such that $f(i)\in X_i\times X_i$ for each $i\in I$, while elements of the righthand side are ordered pairs of functions with domain $I$ such that $f(i)\in X_i$ for each $i\in I$. However, there is a natural bijection between the two sets, and the existence of that bijection proves that they have the same cardinality.
Specifically, for any
$$\langle f,g\rangle\in\left(\prod_{i\in I}{X_i}\right)^2$$
we define a unique $$h_{f,g}\in\prod_{i\in I}{X_i^2}$$
by
$$h_{f,g}(i)=\big\langle f(i),g(i)\big\rangle\;.$$
I leave it to you to verify that the map
$$\varphi:\left(\prod_{i\in I}{X_i}\right)^2\to\prod_{i\in I}{X_i^2}:\langle f,g\rangle\mapsto h_{f,g}$$
is a bijection.