When Agent Smith and his colleagues were destroyed by Neo, the Machines took it upon themselves to update the Agent program. The result was a stronger, faster, and more intelligent version that were exemplified in Agent Green and Agent Jameson.
Agent Green saw himself as vastly superior to the emotional Agent Smith, but shared many traits with the 'deceased' Agent. He employed the same "Gestapo tactics" as his predecessor. He was just as obsessive about making life a living hell for Nil Excess -- his chosen hacker to torment -- as Agent Smith was with Neo. Unbeknowest to Agent Green, however, he was developing the very emotions he claimed to revile.
Following an encounter with Nil, a distortion of the Matrix destroyed Agent Green enough to send him into Inactive Memory, a portion of the Matrix where other destroyed Agent programs were sent until their program was deleted. Here, Agent Green met his predecessors, including Agent Smith, who had a deal for Agent Green. Since some of Nil's human code was lodged in Agent Green's code, he couldn't be reinitialized, so Agent Smith offered to patch the human code with his own Agent code for Agent Green.
Agent Green was reinitialized later, but his consciousness was forced from its location and lodged itself in the only place that was left to receive his mind -- the mind of Nil Excess, which had become receptive to Agent communications. The two embittered enemies met in Nil's comatose mind, where the hacker finally managed to destroy his hated foe.
Agent Green's code, however, still exists in Nil, and in the Matrix, but another intelligence is using his Matrix body. Just who is remains unclear.