Dogs and cats are often mentioned together, as are knives and forks; in that context opposite simply means the other of a pair; but more, it means the other of a complement.
Knives and forks are used together in eating a sit-down meal at a table; they complement each other.
Cats and dogs are both domestic pets that people keep, and also are the most common pet; the sense of complement here is quite a bit weaker though than in the first example.
Here, opposite is not used in the mathematical sense of inverse; where properties of an inverse are inverse to the properties of the original object.