He didn't have a choice.
If you remember, Avery was given $7,000 of Luke's money (as "hazard pay"). This was effectively the crooked cops in the department "looking after" him. In return, they wanted him to take cocaine out of the evidence room so they could pay off a hooker.
When he goes to the evidence room and sees the picture of Luke and his family, he is touched and realises he cannot do it. He goes to Weirzbowski, the police chief, who refuses to hear of any corruption against his men.
Deluca, one of the corrupt cops, then invites Avery out to talk about the cocaine. They get pretty far out of the way, in a forest if I recall. As soon as Deluca steps out of the car, Avery drives away. He's now feeling the fear and worrying for himself.
It's at this point he speaks to his father, who advises him to do the right thing.
So he has a meeting with Scott, one of the crooked cops, about how to steal the cocaine and what to do when people ask questions. Scott answers and Avery records everything. He then takes all the evidence to Killcullen, the District Attorney.
Now, because Avery's father is a judge, Killcullen has the idea that he has been born with a silver spoon in his mouth, so to speak. He seems him as entitled, being given what he has rather than having to work for it. He really doesn't like him very much.
But, he has seriously incriminating evidence which has to be acted on. Not only would it be great for Killcullen's career, it's also indicative of serious corruption in the department. So Killcullen tells Avery what he thinks of him, but proceeds to accept his three requests - in the bigger picture, dealing with the corrupt cops is more important than his own personal dislike of Avery.