Judges have been known to set aside jury convictions when they believe the jury erred on the facts. They specifically give the jury instructions on the matter they’re supposed to decide.
Juries are supposed to decide matters of fact only, not matters of law. If the evidence shows that the defendant did not commit the act and the jury convicts anyway, it’ll either be set aside or overturned on appeal.
Of course sometimes people are wrongly convicted and punished of crimes, but that happens in every country and it’s always bad and must be fought against.