I don't understand what a "free group" is!
In algebra, a "free X" (where X is the name of an algebraic structure, such as "group", "semigroup", "magma", etc.) is basically an algebraic structure in which two expressions are equal if and only if the definition of X says that they must be.
For example, the simplest kind of algebraic structure is a magma: a set $S$ equipped with an arbitrary binary operator $\cdot$, which is only required to be closed (i.e. that if $a$ and $b$ are members of $S$, then $a \cdot b$ exists and is a member of $S$). A magma is not required to satisfy any algebraic identities except the trivial one (that two identically written expressions are equal), and a free magma is one that indeed doesn't — two expressions in a free magma (using only the given generators as variables) are equal if and only if they're written in exactly the same way.
Formally, a free magma can be defined as follows:
- The generators are (distinct) elements of the magma.
- For any two elements $a$ and $b$ of the magma, the expression $(a \cdot b)$ is an element of the magma.
- No two expressions constructed in this way are equal, unless they are written identically. In other words, the expression $(a \cdot b)$ is never equal to a generator, and is only equal to the expression $(c \cdot d)$ when $a = c$ and $b = d$.
- The magma contains no other elements.
(And yes, this definition indeed implies that any (non-empty) free magma must have infinitely many elements.)
Similarly, a semigroup is a magma that obeys the associative law $(a \cdot b) \cdot c = a \cdot (b \cdot c)$, and a free semigroup can be constructed by taking a free magma and identifying any two expressions that can be made identical by applying the associative law.
It turns out that, because of the associative property, expressions in a semigroup can always be written unambiguously without parentheses, simply as ordered sequences of elements separated by the binary operator: any method of reinserting the parentheses will yield equivalent results under the associative law. Thus, another way of constructing a free semigroup is as the set of all finite-length $n$-tuples of the generators, with concatenation as the semigroup operator:
- For all generators $x$, the 1-tuple $(x)$ is an element of the semigroup.
- For any two tuples $a = (a_1, \dots, a_m)$ and $b = (b_1, \dots, b_n)$ in the semigroup, the concatenated tuple $a \cdot b = (a_1, \dots, a_m, b_1, \dots, b_n)$ is an element of the semigroup.
- No two tuples in the semigroup are equal, unless they have the same length and exactly the same elements.
- The semigroup contains no other elements.
It's common to also include the empty tuple $\epsilon = ()$, which then acts as an identity element, in the free semigroup. Technically, though, what we then have is a free monoid, a monoid being a semigroup with an identity element $\epsilon$ that satisfies the additional law $a \cdot \epsilon = \epsilon \cdot a = a$ for all $a$.
Finally, a group is a monoid with inverses: that is, every element $x$ of a group has an inverse element $x^{-1}$ such that $x \cdot x^{-1} = x^{-1} \cdot x = \epsilon$. Again, a free group can be obtained from a free monoid by adding inverses for the generators, and identifying any expressions that can be made identical by repeatedly removing pairs of adjacent elements that are inverses of each other.
Similarly, we might e.g. consider free abelian groups, constructed by taking a free group and identifying any expressions that can be made identical by applying the commutative law $a \cdot b = b \cdot a$ to reorder their elements (and removing inverse pairs); these turn out to be representable as (finitely supported) functions from the set of generators to the integers, where the value of the function giving the number of times that generator appears in the expression (with inverses counted as $-1$ appearance).
Or we could skip groups entirely, and instead consider e.g. free commutative monoids; these can be represented in the same way as free groups, except that, since we don't have inverses, no generator can appear a negative number of times in an expression. (A free commutative semigroup is the same as a free commutative monoid, except that it has no identity.)
A free group is indeed infinite, I don't see any problem here.
For the inverse, note that what you said is not the complete definition of the free group. You have to take the words on your generators with the product of concatenation, that's ok, and then you have to quotient by the equivalence relation generated by $x_ix_i^{-1} \sim x_i^{-1}x_i \sim \varepsilon$, where $\varepsilon$ is the empty word, which is the neutral element of the free group.