As a thank you for the people hosting a party I brought them a little present. They said:
"Danke schön! Das wäre aber nicht nötig gewesen."
Shouldn't I have given them anything? Did I do something else wrong?
It's a phrase to express gratitude. It is an indirect acknowledgment that you intended the gift as a gift, and not for satisfying a perceived necessity ("nötig" comes from "Not", English "need" or "poverty").
The confusion probably comes from the literal translation "That was not necessary / unnecessary", which, as I understand it, is a defensive remark to an attack or insult of sorts.
Edit: The more idiomatic translation and English equivalent is probably "Oh, you didn't have to!", in a positive meaning.