Let $x\ne y $ but $f (x)=f (y) $. Then $\{x\}\ne\{y\} $ but $\{f (x)\} =\{f (y)\} $.
So "setminusing" $\{y\} $ from $\{x\} $ (or vice versa) will do nothing to the resulting image, because although we lose the $y $ we keep the $x$ and the resulting image is the same.
But as $f (x) $ does equal $f (y) $, "setminusing" $\{f(y)\} $ from $\{f(x)\} $ will eliminate everything and nothing will be left.
In other words: $f (\{x\}\setminus \{y\})=f (\{x\})=\{f (x)\} $. But $f (\{x\})\setminus f(\{y\})=f (\{x\})\setminus f (\{x\})=\emptyset $.
That's an extreme example but I hope that explains why.
Any non-injective function where A is one "preimage" of a set and B is another will do. Let $f=\sin $ and A is all the reals while $B $ is just a $[-\pi/2,\pi/2] $ interval. Or $f (x)=x^2$ and A are the negative numbers and B are the positive, etc.