Mattingly has had the post for seven years and will step down in September.
The mayor says he wanted to return to his foundation work in Baltimore.
Bloomberg released a statement saying: "As I've said countless times over the last seven years, New York City has been extraordinarily lucky to have a nationally-renowned expert, John Mattingly, ably and tirelessly leading our Administration for Children's Services. When John came to us and said he wanted to return to his foundation work in Baltimore and have more time for his family, I asked him to reconsider. Few people have worked harder and more effectively in such difficult circumstances than he has. Under John's leadership, ACS has adapted many essential reforms that have helped to protect and serve the City's most vulnerable children. On behalf of more than 8 million New Yorkers, I want to thank John Mattingly for his transformative leadership and wish him and his family the very best in Baltimore."
Mattingly saw the agency through child-death scandals, including the 2006 killing of 7-year-old Nixzmary Brown - who was bound to a chair, starved and beaten to death while under the supervision of ACS workers. In the aftermath, the city bolstered corps of investigators who look into cases of child abuse and neglect.
Earlier this year, two ACS workers were charged with criminally negligent homicide in the death of a 4-year-old girl under their care. Both maintain their innocence in the pending case.