The domain is the set of natural numbers. x~y if a natural number other than 1 evenly divides both x and y. Is it an equivalence relation?
The answer: it is not equivalence relation because it is not transitive, i.e. 4~6 and 6~9 but it is not the case that 4~9.
BUT WHY? I could say it is an equivalence relation because 2~4 and 4~8 and 2~8 is transitive. And if the relationship must be satisfied by each and every element in the set then why is the following problem: The domain is the set of integers. x~y if x+y is even is an equivalence relation.
If the domain is the set of integers I can choose x = 2 and y = 3 and get x + y is odd. Therefore I can say it is not an equivalence relation?
Transitivity must hold for all elements in the set. So in your example, we require $\forall a, b, c \in \mathbb{N}$, $a \sim b$ and $b \sim c$ $\implies a \sim c$ in order for transitivity to hold. As such, to show that a relation is not transitive, we need to find a single counter-example where $a \sim b$, $b \sim c$, but $a$ is not equivalent to $c$. But to show a relation is transitive, it must hold for all elements in the domain.
So now lets analyze the relation you defined on the integers: $x \sim y$ if $x+y$ is even.
Consider any $x, y, z \in \mathbb{Z}$. We assume that $x \sim y$ and $y \sim z$, and we need to show that $x \sim z$.
Well, $x \sim y$ means that $x + y$ is even, and $y \sim z$ means that $y+z$ is even.
Case 1: $x$ is even. Then we must have that $y$ is even, as an even number plus an odd number is odd, but $x+y$ is even, so $y$ cannot be odd. By the same logic, we must have that $z$ is even.
Then $x+z$ is even, as the sum of two even numbers is always even. Hence $x \sim z$ as desired.
Case 2: $x$ is odd. Then we must have that $y$ is odd, as an odd number plus an even number is odd, but $x+y$ is even, so $y$ cannot be even. By the same logic, we must have that $z$ is odd.
Then, $x+z$ is even, as the sum of two odd numbers is always even. Hence $x \sim z$ as desired.
Note how this proved transitivity: It assumed that $x \sim y$ and $y \sim z$, and using those assumptions proved that $x \sim z$. What you attempted to use as a counterexample only showed that $2$ is not equivalent to $3$, which is true. It usually isn't very interesting if all elements are equivalent under a particular relation, and you will very rarely work with equivalence relations where all elements of the set are equivalent! You example didn't disprove transitivity. In order to disprove transitivity, you would need to find $3$ integers, $a, b, c$, where $a+b$ is even, $b+c$ is even, but $a+c$ is not even. Of course, this is not possible.