Over time, knowing how to take care of myself I stopped the behaviour completely. It broke the cycle. The guilt, shame, angry interactions stopped. I felt normal and more in control of my life.
I went through this as a child myself. The best thing you can do is show him how to clean up after himself without throwing away his underwear. To clean it in the toilet then wash it in the sink. Just like you would help a young girl when she first has her period. We don't throw our underwear away. It doesn't matter why it happens, but I can assure you that he probably feels ashamed and embarrassed. I felt like I was doing something bad and wrong, and it was frustrating. I tried to hide it. Taking care of yourself is empowering, because accidents happen, it's knowing how to deal with them that's important.
A lot of kids do this when they are having a good time. They either forget to go or they do not go because they feel they will miss something if they leave the room. This may be the problem.