Gary or Imaginary Gary is an imaginary person who used to be Timmy Turner's best friend.
Gary was Timmy's Imaginary Friend who was too cool for his own good. He only existed during the earlier parts of Timmy's childhood. Eventually, Timmy had no need for him, and Gary was stuck within Timmy's brain until Timmy wished him to life. At this point, Gary started to unravel his evil scheme, which was to take over Timmy's life.
Gary tried to steal everything from Timmy: his friends, his family, and even his godparents. When Timmy tries to wish Gary back into his mind, Gary wishes Timmy into his own mind as well. In here, Gary and Timmy engage in battle. Gary uses Timmy's old childhood memories in order to overwhelm Timmy. Cosmo and Wanda are tied up via monkey barrel figures and have their ears stuffed with plush toys resembling the Tellie Tubbies. This prevents them from aiding Timmy. Timmy is nearly buried forever in a huge box of his old toys. Timmy would have been defeated had it not been for Timmy's older memories. Timmy's new video game, Sergeant Surgeon, aids Timmy in Gary's defeat. Ultimately, it is Timmy's worst nightmare, Vicky, that defeats Gary.
After Timmy and his godparents leave his mind, Gary is spat back out. The door that exits Timmy's mind is left unlocked, implying that Gary will come back and have his revenge.