Here is an important example in mainstream mathematics.
On a smooth cubic curve (pick a concrete example, say $y^2 = x^3 + 17$), observe that the line through two points $P$ and $Q$ cuts the curve in a third point $R$, where we use the tangent line at $P$ when $Q = P$ (this is why we want the curve to be smooth). In case $P \not= Q$ and the line through them is tangent to the curve at $P$ or $Q$ (meeting the curve at that point "twice"), the line through $P$ and $Q$ has no third separate intersection point with the curve, but we reasonably declare the third intersection point to be the $P$ or $Q$ at which the line is tangent.
Now define a binary operation $\oplus$ where $P \oplus Q$ is the third point $R$ on the curve that's also on the line through $P$ and $Q$.
This operation $\oplus$ is clearly commutative, but it is not associative.
Example. On the curve $y^2 = x^3 + 17$, let $A = (-1,4)$, $B = (2,5)$, and $C = (-2,3)$. Show $A \oplus B = A$ because the line through $A$ and $B$ is tangent to the curve at $A$, so the third intersection point is $A$ by our convention above. Then $(A \oplus B) \oplus C = A \oplus C = (4,9)$: the line through $A$ and $C$ meets the curve in $(4,9)$. And
$A \oplus (B \oplus C) = A \oplus (1/4,33/8) = (19/25,522/125)$, which is not $(4,9)$. So $(A \oplus B) \oplus C \not= A \oplus (B \oplus C)$.
Letting $+$ denote actual addition on these elliptic curves, $P \oplus Q = -(P+Q)$, so having associativity not hold is comparable on real numbers to saying $x \oplus y = -(x+y) = -x-y$ being commutative and not associative, but that operation on real numbers seems silly, while on cubic curves $\oplus$ seems like a natural operation initially.
Remark. I ignored the issue where a line through $P$ and $Q$ is vertical, requiring throwing in an "ideal" extra point that would be the identity in an elliptic curve group law, but I suggest not mentioning this aspect unless a student in the class notices $\oplus$ as I described it does not make sense when the line through $P$ and $Q$ is vertical.