Well... I disagree with the "Giygas" theory. But I have another. The Devil Machine is actually what keeps Giygas stable as an unborn alien. So, that "Ball" is actually an egg. As for his attacks, it's because he cannot control his powers back then. So he attacks the party against his will. As for why it hurts, it's possibly because he was forced to be born before the right time.