Well, it could be that in this fanfiction, Naruto has some sort of hidden agenda. He might call Sakura ugly as a form of reverse psychology. He could be thinking that by doing so, she'll prove him wrong and become more confident. Or perhaps there's some miscommunication or misunderstanding between them. For example, Naruto misheard someone talking about Sakura in a negative way regarding her looks and he wrongly believes it, so he says she's ugly.
One possible reason could be Naruto's out - of - control power. If in the fanfiction Naruto has some new and extremely powerful abilities that he can't fully manage, Sakura might see him as a monster out of fear. For example, if he accidentally causes destruction while trying to save the village.
Maybe he's frustrated with her lack of progress in combat compared to him and Sasuke. He could also be in a bad mood and say it without really meaning it.
She might be really hurt and start to question her self - worth. Maybe she becomes more withdrawn and less confident in herself.
One reason could be that Naruto has always been more attracted to those who understand his outcast past better. Sakura doesn't really have that kind of connection with him as she comes from a more normal background. So there's a lack of that fundamental understanding between them which hinders any romantic feelings.
Sakura's obsession with Sasuke. Naruto might be fed up with how Sakura always puts Sasuke first, ignoring the people around her who truly care about her, like Naruto himself. So he tells her off to make her realize her wrong priorities.
Perhaps there was some sort of dark influence at play. In the world of Naruto, there are often dark forces and genjutsu (illusion techniques). It's possible that Naruto was under the influence of a genjutsu that made him see Sakura as a threat, so he punched her in self - defense without realizing it was an illusion.
It could be due to Sakura's feelings for Sasuke. If she's overly focused on Sasuke and Naruto gets in the way of her plans regarding Sasuke in some way, she might lash out and hurt Naruto without really meaning to cause serious harm.
In some fanfics, Naruto may ignore Sakura because he has his own emotional traumas to deal with. He might find Sakura's presence a reminder of things he wants to forget or move past, so he chooses to keep his distance. For example, if he has faced a lot of rejection from her in the past, he could decide to just cut her out of his life.
In some fanfictions, it could be due to unrequited love. If Naruto has deep feelings for Sakura but she continuously rejects him in a cruel or thoughtless way, Naruto might feel angry enough to seek revenge. For example, she could publicly humiliate him for his feelings, which would hurt Naruto deeply and lead to thoughts of revenge. Another reason could be a misunderstanding. Suppose Sakura is misjudged by Naruto as having done something terrible when in fact she was innocent. But Naruto, in his ignorance, decides to take revenge. This can create a lot of drama and conflict in the fanfiction.
One reason could be jealousy. If in the fanfic, Sakura gets closer to someone else Naruto cares about, like Sasuke in a different way than he expected, it might make him hate her. For example, if Sakura teams up with Sasuke against Naruto's wishes in the fan - created plot.