Complex sentence: In the episode entitled "Dumped", Gary appears to be attracted to Patrick and SpongeBob thinks that Gary has abandoned him, but the truth is that Gary wanted the cookie that had been in Patrick's pocket for days.
Split into simpler sentences: In the episode entitled "Dumped", Gary appears to be attracted to Patrick, which makes SpongeBob think that Gary has abandoned him. However, Gary only wanted to eat a cookie that had been in Patrick's pocket for days.