The Grim Adventures of Billy and Mandy Wiki

Skarrbot is a robot created by Skarr.

If he was created by Major Dr. Ghastly, it would have been done under the orders of The Dreadbots, who, unknown to her, were taking orders from Skarr.

Skarr seems to treat Skarrbot like he was his son, he always calls him junior and Skarr teaches him things like when Skarr tells him "To stick the knife in his back and twist", meaning to betray your enemy/boss as Skarr did to Hector in the episode (Day of the Dreadbots).

So Skarrbot takes this advice and betrays Skarr.