"Imaginary" Gary was Timmy's imaginary friend before Timmy had Fairies, he was later turned real by Timmy's wish. After Timmy met real friends such as Chester and A.J., he stopped playing with Gary and locked him away in his mind after undergoing therapy. Gary resented Timmy for this, and one day after Timmy wished Gary into existence, he revealed that he hated Timmy after being alone for all that time and wanted to get rid of him to get Cosmo and Wanda for himself.
Gary resembles Timmy, but with black Greaser-style hair, sunglasses, a red coat with a white shirt underneath, and blue pants. Gary shares the same nose shape and buck teeth as Timmy. Unlike his real-life counterpart, however, Gary is not made fun of for his buck teeth and even makes fun of Timmy for his along with other characters.
Gary's personality isn't very bright, he shares some of the traits that Timmy has, such as impoliteness. His two most used phrases are "cool" and "not cool", the latter usually reserved for whatever Timmy wants to do; Gary tries to remain cool himself even when he is in extreme danger from things caused by Timmy.
After Timmy became saddened that neither of his parents would play with him, he found a box of his old five-year-old stuff, and remembered Gary, his imaginary friend, through a drawing. Timmy said that he and Gary were best friends until eventually, Timmy outgrew him due to getting real friends and undergoing therapy. Timmy wished for Gary to become real and was thrilled to have as cool a best friend as him, but at Timmy's school, when Gary quickly replaced Timmy as best friends with Chester, A.J., and Elmer, easily wooed Trixie Tang, and became popular at the same time by cracking jokes at Timmy's expense; Timmy tried to wish Gary away back to his house, only for the wish to be halted by Cosmo and Wanda at Gary's request. Because Gary was a part of Timmy, he could make wishes too. Timmy tried to wish Gary back into his mind, but Gary quickly wished Timmy to be brought there with him.
In real-time, Timmy became paused and stupefied, while his personality was brought with Gary back inside his mind's imagination. There, Gary used objects from Timmy's childhood to tie up and block Cosmo and Wanda's ears so they could not make wishes and then used toy blocks to lock Timmy into a jail tower. While Gary had toys piled on Timmy to crush him, he turned to take Cosmo and Wanda for himself, but Timmy had figured out he could use things from his ten-year-old imagination to defeat his five-year-old imagination's toys and used a Surgeon General robot to free himself. After cornering Gary, Timmy was momentarily scared again by the "monster in the closet", but he remembered that at age six he found out the monster was just a sweater, and at age eight he met a real monster, Vicky, his babysitter. The sweater turned into a giant monster representation of Vicky, which promptly ate Gary, allowing Timmy to escape from through an exit door. Shortly after, Gary was spat up by Vicky because she hated the taste of cool, and he found that Cosmo had left the exit door unlocked. He laughed maniacally for a moment, before correcting himself because doing so wasn't cool at all.
One day, Timmy's friends and family began to disappear after they were attacked by a series of familiar faces from episodes past. Timmy used the parent-free time at home to celebrate at first, but eventually, Cosmo revealed that Gary had sent them a tape. On the tape, Gary revealed that he and the other unwished wishes had kidnapped Timmy's parents, friends, and back up friends (Elmer and Sanjay) and locked them away at Unwish Island, so that Timmy would have to suffer the same loneliness he caused Gary. He also revealed that he had escaped from Timmy's imagination because Cosmo had left the door inside unlocked, much to Wanda and Timmy's annoyance (he also somehow got captured by Jorgen and was transported to this island along with some of the other unwishes).
Through a series of plot-convenient prior wishes, Timmy already had the means to get to the Bermuda Triangle which was where Unwish Island was located, and easily rescued his friends and family and sent them back to Dimmsdale under the impression it was all a dream. Before Timmy himself could escape however, the Great Sphinx showed up and crushed the escape tube. Gary rode on top of it and used it to crush Cosmo and Wanda before stealing their wands. After forcing Timmy through a mock trial where he was quickly found guilty by dozens of Gary copies created by the Magic Copy Machine, Timmy was forced to fight gladiator-style in an arena in front of hundreds of wishes from earlier episodes. Only Mark Chang and The Founding Fathers showed up to help Timmy, but they were all quickly defeated and locked away. The Founding Fathers soon did not like Timmy anymore due to being locked up in a cell so Gary let them out when they said why they don't like Timmy anymore. Timmy bargained with Gary that it was the wishes hatred of him that brought them together, and that by locking him away they would no longer have a common enemy.
Timmy convinced Gary to allow him to use the Magic Copy Machine to create Timmy clones that would serve Gary and the other unwishes at "Club We Hate Timmy". The clones also acted as punching bags and volleyballs for the unwishes. Gary seemed to be at peace with the real Timmy after this, and he has not been seen again after that.
Since Gary has free will and independent existence from Timmy, he is technically a tulpa, which is a sentient solid thoughtform.