King Dedede isn't bad or an enemy. The anime is very off character for the sake of humor. King Dedede is a rascal and a rival but he CARES about dreamland. This is an aspect of his personality that Sakurai has tried to push more than once when he was as the helm of a game. Once in Adventure in regards to protecting the fountain of dreams, and second time in SSE where he was coming up with badges to keep people from turning into trophies.
Also even though Dedede LOVES to challenge Kirby it's because he has grown to enjoy Kirby's rivalry. At first it seems that King Dedede is stealing food just to be an asshole in the 1st dreamland and maybe he is but this happens around the time that Kirby is not considered a citizen of Dreamland yet. According to Melee trophy "A denizen of the far-off, peaceful planet Pop Star, Kirby became a citizen of Dream Land after defeating King Dedede. Even though he's only about eight inches tall, Kirby is an extremely skilled technician. He has the ability to absorb the powers of his enemies, and his elastic body makes him a versatile adventurer."
Maybe it's no coincidence that Dedede was first aggressive with him at the start. Dedede seems keen and wary of Nightmare related invasion in the games.
However since their first battles, Dedede has been saved various times by Kirby and Dedede himself has saved Kirby. Dedede actually LOVES Kirby. When he find Kirby in SSE he tackle hugs his little puffy friend and drags him off on adventure. In K64 he lets him rind his back and carries him, and in Triple Deluxe, Kirby loves King Dedede as well, jumping excitedly when he's free from Taranza and grabbing his hands. They still fight but they are also close friend/rivals now. This is a much different characterization than the anime ever had and one of he reasons I think the anime isn't really very canon.
It also one of the reasons I love the Kirby games especially when there's not much dialogue or story, because regardless of all that, through just a bit of story and subtle changes across games, we're still given character depth and development. We're also given a unique protagonist and antagonist relationship in video games. No other characters have changed and are depicted this way.