In universal algebra a general algebra has a signature, that is a finite set of sort, which together form the universe, and relational symbols, functional symbols and symbols for constants. Additionaly, certain equations are stated. In this setting, a free algebra over some set $X$ of generators is given as the Term algebra modulo the stated laws. If $X$ is countable, the free algebra could itself be at most countable. This could be looked up for example in these lecture notes, see Proposition 13 and the explanation of it.
I thought I have understood these notions, for example consider the signature of a single sorted algebra $(S, s, 0)$ where $S$ is the universe, $s$ the successor function, and $0$ a constant with the usual first order peano laws, then the term algebra would be all term $0, s(0), s(s(0)), s(s(s(0))), \ldots$ giving essentially the natural numbers.
But then I thought about vector spaces, or modules over a ring. And these could be written over a two-sorted signature. Now a vector space is always finitely generated, but the term algebra over some set of generators is certainly not a free object (or isomorphic to the vector space, as the vector space itself is free).
So why that, where exactly do the notions of universal algebra break down here? As I see it, if we define a generating set as a set such that every element could be written in terms of the operations with just these elements, then certainly the term algebra would work, but if we define a generating set as a set such that the mininal substructure containing this set equals the whole algebra as in the module case, then the term algebra over a generating set would not work.
So, the discrepancy is that in universal algebra the free algebras are exactly the term algebras, and any two free algebras are isomorphic as stated here, but in the case of vector spaces, every vector space is itself free, but is certainly not isomorphic to its term algebra! So could anyone explain this discrepancy?
As has been pointed out in the comments, fields are problematic because their theory is not equational. So let's think about modules over a ring (with $1$). To get an analogue of the term algebra for modules over a ring, you have two choices:
1) If you work in the category of modules over a fixed ring $R$, then you need to work in a single-sorted theory where variables denote module elements and the signature comprises $0$, $+$, and a function symbol $\mu_r(\cdot)$ for each $r \in R$ denoting the action of $r$ on the module. Given a set of variables $X$, the term algebra generated by this language and taken modulo all equations that hold in every $R$-module, will be a free module with basis $X$.
2) If you want to work over a two-sorted language with a sort $\cal R$ for ring elements and a sort $\cal M$ for module elements, then you need to work in a category which lets the rings vary as well as the modules. So objects would be pairs $(R, M)$ where $R$ is a ring and $M$ is an $R$-module. A morphism $f : (R_1, M_1)\to (R_2, M_2)$ would be a pair $(g, h)$ where $g$ is a ring homomorphism from $R_1$ to $R_2$ and $h$ is a module homomorphism from $M_1$ to $M_2$ with the latter viewed as an $R_1$-module via the action of $R_1$ on $M_2$ induced by the action of $R_2$ on $M_2$ via $g$. A free object in this category would be parametrised by a pair of sets $X$ and $Y$, where the elements of $X$ generate the ring and the elements of $Y$ generate the module and would constitute $(\Bbb{Z}[x_X], \Bbb{Z}[x_X]\langle Y \rangle)$ (see note on notation below). If you work over a signature for the two-sorted theory that represents the ring and module operations in the natural way, then $(\Bbb{Z}[x_X], \Bbb{Z}[x_X]\langle Y \rangle)$ is isomorphic to the term algebra generated by $X$ viewed as a set of variables of sort $\cal R$ and $Y$ viewed as a set of variables of sort $\cal M$ modulo the equations that hold in every ring and in every module over a ring.
Notation: in the above, I am using $R[x_X]$ for the ring of polynomials whose variables are indexed by the set $X$ (i.e., the free $R$-algebra generated by $X$) and $R\langle Y \rangle$ for the free $R$-module with basis $Y$.