I was working through one of the exercises in Topology: A First Course by Munkres, and I came across this:
Let $f : A \to B$ be a surjective function. Let us define a relation on $A$ by setting $a_0 C a_1$ if $f(a_0) = f(a_1)$. Show that $C$ is an equivalence relation.
Now essentially what this is saying is the following:
$$C = \{(a, b) : f(a) = f(b) \ \ \text{where} \ \ a,b \in A\}$$
But since $f$ is surjective and not injective we could have $f(a) = f(b)$ when $a \neq b$. But clearly by what we have above $aCb$, where $C$ is an equivalence relation on $A$.
Is this an error or a misunderstanding on my part or can an equivalence relation relate two elements of a set that are not in fact equal to each other?
The point of equivalence relations is to generalize the idea of equality. There's only one equivalence relation on a set that is the equality relation, and every other one is not and necessarily declares two unequal elements to be "equivalent".
I would recommend cracking open a discrete math/intro to proofs book and reading about how equivalence relations are connected to partitions on a set.