I'd complain to the head about the teacher bullying her in front of the class, and say that you'd go to the education board/put in a formal complaint about the teacher if it doesn't stop. That sort of humiliating a child who is already struggling is absolutely disgraceful in 2023, and tbh, I'd have half a mind to go your child up today (or tomorrow) and walk straight to her classroom and have it out with the teacher, and warn them you'll will put in a formal complaint and even pursue harassment charges against them. NO, I am NOT kidding! I am very, very serious. When next your child is in school, go to her classroom at pick up. You need to sort this teacher out.
As her class teacher is such a bully and your daughter is so worked up, I do not recommend sending your daughter to school on swimming day. I am a very strong believer in traumatic events at school can harm you for life. I speak from experience. If your daughter can swim then I would not force her to go. She needs your support, she needs you to have her back. For whatever reason, something has happened and she is traumatised. Be her soft place to land, don't force her to go to school on the day.
First, go speak to her class teacher. Don't give them any warning, or even tell your daughter (she might inadvertently tell the teacher and give the teacher the heads up so the teacher leaves early/can't be found), just get there early at her classroom and walk in and demand to speak with the teacher.
Then, follow up with an email to the head and say if the teacher continues bullying, you will proceed with action.
You may even need to have her change classes/teachers.
Whatever you do, DON'T force your daughter to go, and DON'T let her teacher continue to bully your child. Stop all this, and put a stop to it right now.