It was originally created by a private company, that went a bit too far in marketing it to criminals. Undercover agents asked the CEO "How do I use this to prevent the police from monitoring my drug smuggling", and he answered the question.
In order to keep the feds from throwing them in prison, the remaining execs needed to provide names, and what better way than to compromise the phone and market it to criminals?
Around the same time, law enforcement cracked a more popular custom phone used by criminals, so gangs started looking elsewhere. And the FBI was waiting for them.
It was an insane operation. It was being run from a local FBI office (San Diego), not headquarters. A bunch of low level agents.
But it provided massive police intelligence around the world.
It also screwed over a lot of the contractors who worked on it. The Android developers who designed the phone are now on organized crime's radar, even though they thought they were just making a secure phone.