Why do I have duplicate groups in Contacts app on my iPhone? If I open the Contacts app on my iPhone I get duplicate groups, hence duplicate contacts.
I started to delete one of a duplicate contact but they both gone away.
I thought I could solve this problem going on my Mac and delete the duplicate groups but there I don't have duplicates.

I'm using iCloud for syncing contactes between my MacBook Pro and iPhone.

How can I solve this problem?
The best procedure is to one by one, turn off each cloud sync source of contacts.

They will remain in the cloud and be removed one by one from your iPhone.

When you have all cloud accounts turned off as far as injecting contacts into the contact app, you will be left with only the local groups and contacts stored on the device itself. If you don't wish to have a local contact on the phone, sync and delete these from a computer (or manually from the device).

At that point, re-establish the cloud sync for each account - checking that there are no duplicates after each addition.

Once you have eliminated the possibility of duplicates locally vs. cloud - you can quite easily clean up the cloud source of duplicates if needed.