If you were clearly somewhere else, gather up some proof (eg witnesses, teacher at the school where you were etc).
Is the journey local to you, or is between two stations miles away.
There have been cases where someone has missing information, and done searches and found someone with a similar name or birth date, and got the court to summon those instead, mistaken idenity.
If you have a letter from a court, you will normally need to write back, and say although some details are same (eg name), it wasn’t you as you were at X and have witnesses. Sometimes a photo can sort it out, especially if prosecutors have image of someone else (it’s a bit pointless having to go to court for someone to say that is not same person)
Whoever annoyingly gave your details is the cause of this, but obviously the clerk and admin staff at the court aren’t going to know this until you tell them. Unfortunately if no one tells them the case will eventually get to court, they might they convict in defendants absence, which then causes further problems. If there is a phone number for the court might be worth ringing them (probably have to wait until Monday) and asking for who is procescuting as you were clearly somewhere else and haven’t made such a journey, and can they also inform them or give you the contact details.
I am sure, someone with more knowledge will be along soon to help.