Turn the question around for a second.

If all charges either repelled or attracted each other - then there wouldn't be any unlike charges.

That is to say this is part of the definition of unlike charges.

As to why it happens this way with electric charges this is because the electric field is a vector field - it points in a definite direction.

The force F on a charge q in an electric field E is given by F=qE=qE and it points along the direction of the field E.

This is the way electric fields actually work, beyond that, there is no "why".