Oh Lou, I'm so sorry you're having this problem, it's so annoying to clean up poop, isn't it? But, it's also perfectly normal. It's called encopresis and it's a small leakage, or a full poop, that is in any place where it should not be, so any place other than the toilet. I had a friend who recounted how her grandson was not going to the toilet for a poop but had a favourite potted plant that he would hide behind, it was his special poop place. If it’s any consolation, he’s now 13 and perfectly capable of using a toilet!
According to Dr Sears, this problem is one that is more common in boys than girls and can occur up to age 6. It can be connected to stress or constipation, because the body just, basically, gets so full it has to let it all go, but it can also be that your young person is so immersed in play or something else that he genuinely can't control the need to go to the toilet, even if that toilet happens to be not the toilet but his undies or behind his favourite plant.
If you're worried, it might help to keep a diary of when it happens, and when he uses the toilet for a poop, and keep a note about the consistency of the poop. You can use this information to talk to the GP if it doesn't resolve by around the age of 6. It's really important to be careful how we manage and talk about the issue, as it can be quite embarrassing for him, as I am sure it is for you if you're in polite company when it happens.
If you keep a diary for a few months, you'll be able to detect when it happens, and be able to make a really informed decision on where you want to go next. If you think there's a pattern, see if you can upset it by taking measures. Have you reminded him to go to the toilet? Can you make sure he's drinking enough water? Does he eat his veggies? Can you substitute some of his favourite foods for fibre rich foods like fruit? If you're still worried, and you can't wait for it to resolve over the next few years, yes I keep emphasising years as it's not uncommon up to age 6, you might like to take your poop diary and a food diary, to the GP.