I looked up the definition of an infinite product of (finite) groups on Wikipedia. It says that the product of the groups $G_i, i\in I$, as a set, is the set of functions $$ f: I \to \bigcup_{i\in I}G_i $$ satisfying some things.
My question is, how is the union defined? The union makes sense if the groups are subgroups of some large group, but otherwise I don't understand how this is defined.
By definition, $\bigcup_{i\in I}G_i$ is just the set of all $x$ such that $x\in G_i$ for some $i\in I$. You just literally take all the elements of all the $G_i$ and put them together in one big set. There is no reason to think that this union has a natural group structure or anything like that, but that's fine; it's just a bare set of elements, and that's all you need in order to be able to talk about functions $I\to \bigcup_{i\in I}G_i$.