To foul one's nest is to do or say something that disadvantages you and ruins or damages your own interests in some way.
Birds are usually very careful to keep their nests clean and not to poop in them: this idiom compares a bird soiling its nest with the actions of a person, or people.
The expression to foul one's nest (or foul one's own nest) comes from the proverb: "It's an ill bird that fouls it's own nest".
Examples of use:
1. She was hoping for a promotion at work but she fouled her nest by spreading rumours about the Managing Director.
2. Why do people foul their own nest by leaving litter and rubbish in our beautiful countryside?!
3. He fouled his nest by treating his family badly. Now he is a lonely old man.
4. Her family will not speak to her because she fouled her own nest by stealing from her sister.
Image © William Warby