Anime characters often portray real-world character traits, which means some of them have low self-esteem and lack confidence in their abilities or inherent worth. Don't we all, at some point in time or another?
Some anime characters with low self-esteem make it obvious. Ritsu Sohma spends a full episode of Fruits Basket screaming apologies for her slightest mistakes, and Yuuri Katsuki's inner monologue in Yuri!!! on Ice is filled with self-recrimination. Others are more subtle - Naruto's Kakashi Hatake might be a powerful ninja who is sure of his strength, but he's wracked with guilt over a turbulent past, and views himself as trash.
Characters who are unsure of themselves can add a touch of realism to the series in which they exist, and even if they do eventually gain confidence, their initial lack can be the starting point for a great character arc.
Guilt can really eat away at a person's self-esteem. That's what happened to Shouya Ishida in A Silent Voice, who thinks of himself as practically worthless because of his history bullying Shouko Nishimiya for her deafness in elementary school.
While it's reasonable to feel remorse and try to make up for past mistakes, Shouya takes it to another level. His guilt poisons his sense of self-worth to the point where he feels like he doesn't deserve to live. It doesn't help that though Shouko was actually being bullied by the whole class, Shouya is forced to shoulder the blame for the whole thing, and begins to experience isolation and bullying himself as a result.
Shinji Ikari might be in charge of piloting a giant robot and saving the planet from Angel attacks, but that doesn't mean he feels good about himself. In fact, Shinji's low self-esteem is one of the focal points of Neon Genesis Evangelion. Perhaps because he was raised by a father who treats him like he's a weak and worthless disappointment, Shinji lacks confidence in his ability to pilot an Eva and perform more ordinary tasks like forming close relationships or existing as a person with inherent value.
At the start of Food Wars!, Megumi Tadokoro is totally lacking in confidence. She messes up cooking assignments because she's nervous and doesn't perform well under pressure, which leads her to getting bad grades, and to her classmates and teachers believing that she's just as weak and untalented as she thinks she is. Things look hopeless for Megumi, but through hard work and support from her peers, she does eventually start to improve her cooking skills and her self-image.
Hachiman Hikigaya believes himself to be fairly intelligent, but that's the only positive trait he thinks he has. He views himself as a fundamentally flawed human being in a world that's set up to ensure his failure at anything he tries. He doesn't just have low self-esteem - he utterly loathes himself. He even purposefully sets up situations where he will be hurt or ostracized, on the grounds that what happens to him doesn't matter as long as everyone else is happy.