Sofia the Worst is the evil clone of Sofia from Sofia the First and is the main antagonist in the episode, Sofia the Second. Sofia the Worst is the exact opposite of her kinder counterpart and is thus spoilt, mischievous and generally dislikable - in the manner of a classic "spoiled brat".
When Sofia (the actual one) wants to go to the hootenanny but promises her stepfather, King Roland II, to show Joy in the castle at the same day, she notices Cedric trying a duplication spell on Wormwood. She goes to his workshop and makes a duplicate of an apple as a test (with a pink outer layer) and herself for real (in a pink dress). Sofia has that duplicate be with Joy while she goes to the hootenanny. When Clover the Rabbit notices that the pink apple is rotten, the duplicate reveals to be evil and locks up Clover in Wormwood's cage while also taking the original apple.
While Princess Amber and Prince James were about to leave, the evil clone decided to roll half of the apple on the floor for James to slip on thinking it was "funny". Amber noticed this isn't how Sofia acts (she even got confused when seeing the real Sofia right after thinking that she changed her gowns so quickly).
While showing Joy around the house, she gives the fake amulet to Joy since she likes it a lot (this action contradicts the promise the real Sofia made to her stepfather when given the real amulet). She plans on pulling pranks with her. Meanwhile, Cedric got surprised by this and asked the clone for the amulet. She has him close his eyes saying that's when she might give it to him. It was just a trick for Joy and her to leave. Joy doesn't want to prank others and feels like taking the tour in the castle. Seeing as the clone would rather go to the hootenanny, she tricks Joy into a game of hide-and-seek as she leaves the castle to go to the dance (Joy finds out minutes later when someone told her she left just to tell her father).
In the hootenanny, the real Sofia sees the clone as she reveals her evil side by messing with others including Sofia's step-siblings. The real Sofia locks the clone in a shed to make sure she doesn't cause any other mischief while the real Sofia tries to makeup for her actions. However, she escaped.
While arriving to the castle right after her good counterpart arrived, she found an oil can and decided to oil the floors causing Baileywick to slip and fall. She causes other mischief along the way which even includes ruining the model bridge Roland and Lord Gilbert were working on. The real Sofia told her stepfather the truth and had Cedric reverse the duplicate spell. The evil clone just went with it as he stated "it was fun while it lasted". Cedric made her disappear which included the fake amulet.