The real Carandiru prison was demolished in 2002, it will be transformed into a park with arts facilities. One block (#2) was left intact to be used as a museum. The film was the last thing they used the prison before demolishing 90% of it.
Dr. Drauzio Varella wrote the original book at the encouragement of a patient he was treating for lymphatic cancer. That very patient happened to be Hector Babenco, who recovered and went on to direct the film adaptation.