The bad guy is similar to the negativitron in Littlebigplanet 2.
the both were "part of you"(however in LBP2. he was refering to the creators.)
they represent the "negative" part of something, and they try to avoid you from advancing.
the bad guy in this game had fear, he feared because if you died, he will die too.
his fear made him try to stop you, because he wanted to live and stay there.
but the main character wanted to escape, he wanted to live and enjoy life.
at the end the main character escaped(maybe he died too) and was happy, and the bad guy died, but he was in the dark place, he was safe.
so it's a happy ending for everyone!