The ostensible purpose of the juvenile justice system is to try to rehabilitate children who have gone astray. The theory is that children who have committed crimes may simply be misguided, and there is still hope to save them from a life of crime. For the most part, adult offenders are considered to be beyond rehabilitation, and the primary goals of the criminal justice system are to punish and prevent further crime through deterrence and incapacitation.
Juveniles have different courts and different rights. Usually children have less rights than adults. On the flip side, juvenile offenses usually do not carry the same stigma or harsh consequences as adult convictions.
Like adults, juveniles have a right to an attorney. Unlike adults, however, they have no right to a jury trial. Juvenile court judges have tremendous discretion when deciding what happens to a child who has committed a crime - they can send the child home, to a group home placement, to treatment, or to juvenile hall. If a minor fails in one setting, the judge may try a different one. Minors also have less right to privacy compared to adults, so they can be searched under circumstances where an adult could not, like at school.
Sometimes a court will decide that a particular child who committed a particular crime should be tried as an adult. This may happen if the child is particularly mature or the crime was particularly sophisticated or violent. When that happens, the case is transferred to a regular adult criminal court. At that point, all the rights, procedures and protections that normally apply to adults then apply to the child.