The law in Canada, and presumably in many US states and many other countries, presumes that young people are not as aware of the consequences of their actions and especially of either legal or long term consequences. This is particularly true nowadays. Much older friends of mine tell me about the 1950’s, the cops picking them up and taking them home, where the consequences were much more painful than the system.
The thought was that records of charges for youthful crimes - vandalism, shoplifting, trespassing, drug possession, etc. - would have an impact on their life that did not reflect their adult character.
When I think on some of the really stupid (but not horrible) things I did as a kid, having that follow me around as an adult would be severely career-limiting. Note this applies to below age 18 - in Canada, below 14 (or is it 12?) you cannot be considered to have criminal intent - don’t understand well enough consequences to realize what you are doing is extremely bad. The Juvenile laws protect those over that age but under 18, where you may understand the criminal intent, may have criminal intent, but are still not developed enough to appreciate the long-term consequences.
As for victims - children can be mean and pick on anyone. Peers may be cruel about something that happened to the victim. Society is still not above blaming the victim, especially for sexual crimes. There may even be a disagreement over the circumstances of the case, and some blame the victim. The presumption is that a victim would want the details left behind and not be the continuous center of attention - basically, a celebrity (in a negative way) by chance. It’s been tradition - and law - not to name the victim of sexual assault cases no matter what their age, for roughly the same reason.
In many cases, naming the perp or victim gives obvious clues to the identity of the others; in a situation where two adults are found dead in a home and a child is charged, the obvious implication (usually true?) is that the child killed his parents. Naming the victims but not perp makes it rather obvious.
There was a case in Canada (Winnipeg? or Regina?) where the accused wanted all the details including names kept confidential, arguing that was the law. There may be many cases where the whole community knows, but in a number of other cases, it’s all behind closed doors. The stepfather was a college professor and nobody knew at work; without official confirmation, his job was safe. The victim (it happened when she was 14) and her lawyer had to actually argue for a “non-publication” ban.