Solution 1:

Here is a context of group action where ergodicity arises naturally. As pointed out by Martin, the definition given in the grey box applies to more general situations where the transformations are not required to be measure-preserving, and the group is not countable discrete.

Take a probability measure space $(X,\mathcal{A},\mu)$ and let a countable discrete group $G$ act on it by measure-preserving transformations.

First, this means that each $g\in G$ induces a measurable map $g:X\longrightarrow X$ such that $\mu(g^{-1}(A))=\mu (A)$ for every measurable set $A\in\mathcal A$. It is standard to write $g\cdot x$ for $g(x)$.

Second, we have a group action: the identity of $G$ induces the identity on $X$ and $g\cdot (g'\cdot x)=(gg')\cdot x$ for every $g,g'\in G$ and $x\in X$.

The action $G\curvearrowright(X,\mathcal A,\mu)$ is called ergodic if $$ g\cdot A=A\quad \forall g\in G\quad\Rightarrow\quad \mu(A)=0\mbox{ or } 1. $$ That is, up to measure $0$ sets, the only invariant measurable sets under the action of $G$ are $\emptyset$ and $X$.

Remarks: 1) As pointed out by Stéphane Laurent, the particular case $G=\mathbb{Z}$ corresponds to the action of a single measure-preserving transformation $T$. Then the action is ergodic if and only if $T$ is ergodic in the usual way. 2) By Koopman representation $u_g(f):=f\circ g^{-1}$, we get a unitary representation $g\longmapsto u_g$ of $G$ on $L^2(X)$. In particular, $u_g(1_A)=1_A\circ g^{-1}=1_{g(A)}$ for every $A$ measurable. So ergodicity reads: there are no notrivial projections $p\in L^\infty(X)$ such that $u_g( p)=p$ for every $g\in G$. Identifying $f\in L^\infty(X)$ with multiplication $m_f$ by $f$ on $L^2(X)$, we get in $B(L^2(X))$: $u_gm_fu_g^*=m_{f\circ g^{-1}}$. And now ergodicity reads: there are no nontrivial projections in $L^\infty(X)\subseteq B(L^2(X))$ which commute with $G\subseteq B(L^2(X))$.

Example: take a standard Borel space $(X,\mathcal{B},\mu)$ equipped with a $\sigma$-finite probability measure, i.e. a standard measure space. Then every essentially free ergodic group action $G\curvearrowright(X,\mathcal B,\mu)$ by an infinite countable discrete group gives rise to a $\rm{II}_1$ factor von Neumann algebra $L^\infty(X)\rtimes G$ by the so-called group-measure space construction of von Neumann. Whenever $G$ is amenable and $X\simeq [0,1]$, we get this way, up to isomorphism, the unique (by Connes' deep work) injective $\rm{II}_1$ factor $\mathcal{R}$.