The catchphrase, because it should be considered as a whole item and not broken into separate pieces, is:
don't get mad, get even
The Cambridge English Dictionary describes its (the entire catch phrase) meaning perfectly, and the example it quotes also indicates its origin.
This is my advice to wives whose husbands have left them for a younger woman — don't get mad, get even!
The same dictionary defines the idiom, get even, as
to punish someone who has done something bad to you by doing something equally bad to that person
The catch phrase is a borrowing of a north American expression, one which might be said to a woman whose husband had left her, or, had been unfaithful with a younger woman. The wronged wife would be incited to employ the energy of her anger in a more productive way, i.e. to channel that anger in order to wreak revenge.
Instead of losing her temper (‘get mad’ AmEng), she should seek financial compensation (‘get even’) or do anything that would "punish" the unfaithful spouse or partner.
It appears that this catchphrase has been adopted in British English, and can be used in any context where a person advises a wronged person to focus their energy in getting personal justice.
For those who want to learn more: the American etymologist, and OED contributor, Barry Popik, cites 1956 (Newport) as the earliest written instance, but the expression in speech most likely predates that year.
Judging by the following citations, the American English get mad has crept into the British vernacular, and whether native speakers like it or not, it is here to stay.
British English ‘get mad’
Literary examples of get mad (i.e. to become angry or extremely upset) found in the British National Corpus (link) Tip: Write get_mad and click on the search button.
Maria nodded, staring straight at Clare with her bulging eyes. "He gets mad when Gary doesn't sleep, he says it's my fault, he says I make him do it -- and --" She stopped again. "How old's Gary?" asked Clare, after the silence had lasted a little while.
[...]
Maria shook her head convulsively. “He was shouting at me. Calling me. I asked him —I told him ‘Shut up or you'll wake Cathy too’ and he got madder — he — he thinks — he says I keep them awake so — so — so I don't have to go to bed with him.”
Her living image By Jane Rogers (1984)
I woke up a few times and got Mum out of bed all bleary-eyed and irritable in her nightie telling her a bogey-man was after me. First she was terrified there was a burglar, then when she'd searched the house from top to bottom she got mad and shoved me back to bed. You can picture it, can't you.
Gate-crashing the Dream Party By Alison Leonard (1989)
If my Mam got mad with me for something I'd done -- or more often something I hadn't done -- she used to make moaning noises and stagger about the house as if she was dying. My Dad used to say, "Now look what you've done to your mother," and if I answered back, he would start pelting things at me -- plates, cups, his dinner, the carving knife, and once a picture of Jesus floating up to heaven with a lamb tucked under each arm
An alternative assembly book Hoy, Mike and Hoy, Linda, Longman Group UK Ltd, Harlow (1991)
Constipated? Get mad! A group of constipated patients who were hypnotised then made to feel angry soon got rid of their problem
Excerpt from She magazine, London: The National Magazine Company Ltd (1989)
Further evidence from Google Ngram suggests that the trend for get mad is increasing, but it still has a long way to go before it catches up with get angry. Although the chances of that ever occurring, in either American or British English, is considerably low because get mad is INFORMAL.

The answers supplied by @Andrew, @Lambie, and @LawrenceC have already explained the different meanings and usages of “get mad” in AmEng and BrEng.