Chain of custody refers to who has the evidence when. Evidence has to be documented every step of the way, because it is vulnerable to tampering. Since the evidence is collected for use in an investigation and trial, it has to be legitimate. If the chain of custody is not maintained, the evidence is subject to being labeled inadmissible by the judge.
Every person who handles evidence is part of the chain of custody. Each person needs to sign a log indicating so. When the person has the evidence, the evidence is said to be in that person's custody. Initially, detectives or crime scene investigators collect the evidence, bag it and tag it, and sign the custody form. Then each person who handles the evidence after that also has to sign the form.
During the trial, the prosecutor is the one who has the evidence in his or her custody and uses it as exhibits in the trial.
The main reason for the chain of custody is to ensure that there is no evidence planting or tampering. The chain of custody is an important part of the legal system, and it protects both police officers and suspects from wrongful accusations or convictions.