Terry is from the gelatin dimension. When the Phineas and Ferb of Terry's dimension went to the adoption center and chose Perry, they took Baljeet along with them and he chose Terry. Phineas even mentions that he remembers seeing a turtle at the adoption center when they picked out Perry, which must have been the Terry of the First Dimension. Agent T promised to help fight Heinz Doofenshmirtz if the gelatin was drained from his dimension.
Just like Agent P, his color is unlike the real animal.
Website Summary:
Terry the Turtle, or Agent T, is an OWCA agent from a parallel dimension. Phineas, Perry, and friends meet him in the gelatin dimension when he dives in to help them against a fearsome gelatin boss.
After the battle, Major Monogram contacts Agent T's handler and contracts Agent T to help out Agent P and the boys against the Evil Dr. Doof of the Second Dimension. Agent T joins them for the rest of their adventure.
Agent T is tough and reliable in Agent mode, and being a turtle, his main strength is being extra-hardy, taking less damage from enemies than the other selectable characters.