OK, normal weirdness of boys aside, you're right, it's a wrong behavior that needs to be stopped.
First he must understand from you, that this is totally not allowed. Not funny, not shocking, not impressive, not anything, just not allowed. Once you know he understands that, make sure he understands that he will absolutely have a consequence every single time he does it.
You will be calm, cool, in charge, and he will have a consequence. IN ADDITION to the fact that he has to clean it up. Cleaning it up goes without saying. He must clean up his own mess, but that's not a consequence for wrong behavior. I wouldn't ask him why, its too much dialogue and attention-what would the right answer be? don't let him control the situation, just teach him it's not allowed.
So, yes, make him clean it, even if you secretly have to finish the job, make sure he has a laborious task. ALSO implement your most effective discipline based on what works for you at other times-as in makes wrong behaviors stop. Make it the maximum one he really wants to avoid. 5 is a little old to invent a new one. Use the best of your arsenal. You want this to stop. If you ever catch him in the act-this is the best time to teach him. Calmly implement discipline immediately. But even if you don't find it until afterwords, he's old enough to have a consequence after the fact. And he must always clean it. Good luck!