Question: For example, $2\*x = 2\*5$ implies $x = 5$ but how come, if $2$ doesn't have an inverse?

Answer: 
The relevant property is that $\Bbb{Z}$ has no zero-divisors - that is, if you multiply two integers and get $0$, one of them had to be $0$. This is relevant because

$$2 x = 2 \cdot 5 \implies 2 x - 2 \cdot 5 = 0 \implies 2 \cdot (x - 5) = 0$$

But since $2 \ne 0$, we find that $x - 5 = 0$.

---

Alternatively, you can find an injective ring homomorphism $\Bbb{Z} \to \Bbb{Q}$, where $2$ *does* have an inverse.
It is because $\mathbb{Z}$ is an integral domain. It basically means that cancell ation is allowed, even though there is another formulation. We say $R$ is an integral domain if $xy=0$ then either $x$ or $y$ is zero. Above, you can rewrite $2x-2\cdot 5=0$ so $2(x-5)=0$, but $2$ isnt zero, so $x-5=0$ so $x=5$.