You are confusing derivation with proving.
If you want to prove that some $X = Y$ statement is true, you have to show that that statement can be derived from some other statement which is already known to be true. You're doing it backwards: you're deriving from $X = Y$ some statement which is true, namely $0 = 0$.
To generalize this, let us observe that in a typical mathematical proof-by-algebraic-derivation, you start with some questionable statement $S_0$ and then you go through some derivations to show that it is equivalent to some truthful statement $S_T$: $S_0\Leftrightarrow S_1\Leftrightarrow S_2\cdots\Leftrightarrow S_T$. This proof method works only because the arrows go both ways, and so the opposite derivation is possible: although you are proceeding from $S_0$ toward $S_T$, you are in fact at the same time showing that $S_0$ can be derived from $S_T$. For this method to work, however, none of those arrows must be a one way implication (denoted by $\implies$). If you have such a one-way "trap door" in the logic, then the crucial reversal of implication cannot happen, and so the proof does not hold. Even though you arrive at a truthful statement $S_T$, that statement does not imply the truth of your starting proposition $S_0$.
Under most derivation steps in algebra, you don't have to worry about the direction because the derivations establish equivalence: this means that there is a two-way implication between the statements. For instance $3X = 3Y$ can be derived from $X = Y$, but also $X = Y$ can be derived from $3X = 3Y$. These statements are equivalent, and so we can connect them with a double arrow: $X = Y \Leftrightarrow 3X = 3Y$.
Some derivation steps, however, only go one way, because they involve some "trapdoor" function: an operation which cannot be reversed, because it erases information. One example of a trapdoor function is multiplication by zero, around which your question revolves. Another example is taking a remainder in a division.
For instance, suppose $X$ and $Y$ are integers. Then have $$X = Y \implies (X\mod 3) = (Y\mod 3)$$
(If X equals Y, then the remainder left when dividing X by 3 is the same as the remainder left when dividing Y by 3). However, the converse isn't true. Just because two numbers have the same remainder when divided by three doesn't mean that they are equal.
More about "trap doors"
More formally, we can define "trapdoor function" as any function which fails to be one-to-one (or injective), because such functions have inverse functions. If if $g$ is an injective function covering the entire domain of $X$ and $Y$, then we have $X = Y \Leftrightarrow g(X) = g(Y)$. If $h$ fails to be injective (is not invertible) then we have $X = Y \implies h(X) = g(Y)$. The function $g$ does not have to be onto, only one-to-one.
An example of an injective function is $e^x$, over the real numbers. It is a one to one function in that it maps each domain value to a unique value in its range. (But it is not onto: it does not map a domain value to every real number: its output is only positive real numbers. That doesn't matter.)
Therefore, we know that $X = Y \Leftrightarrow e^X = e^Y$. In the real domain only!
In the domain of complex numbers, $e^x$ is not one to one. More than one value of $x$ will map to the same range value. The inverse function, $\ln x$, is not actually a function in the complex plane, because it is multi-valued. (When the complex logarithm is used as a function anyway, it has to be restricted to a particular "branch".) Therefore if our proof involves complex numbers, $X = Y \Leftrightarrow e^X = e^Y$ does not hold. Complex exponentiation is a "trap door" and so the implication only goes one way: $X = Y \implies e^X = e^Y$.