The idiom "foul one's own nest" has its origins in the behavior of birds who will dirty their own nests with excrement or waste. The phrase is now used in a more figurative sense to describe someone who is behaving in a way that is damaging or harmful to their own reputation or interests. The usage of the idiom is not limited to any particular context and can be applied to a variety of situations where someone is harming themselves or others by their behavior.