My headcanon:
The boy is trying to help by setting the darkness in the hearts free, and it is meant to be the heroes’ jobs to purify the darkness once released. But the heroes are just too weak in terms of their hearts to do it. They don’t know the truth, and so they think he’s an enemy, when he’s just doing what he thinks is right. Once Stardust realizes this, he will realize it was his fault for being too weak to save his friend, and that shy is a better hero than him because she focuses on feelings, not strength, as a true hero should.