Most characters, like real people, have something wrong with them. Maybe your character cheated on their boyfriend or girlfriend, or maybe they have an irrational fear of peanuts. Some characters are just insecure and behave worse than the people they believe themselves to be, while others have full blown PTSD or want to avenge their dead partner with a full on mech-fueled genocide. Regardless of what traits define a specific character, it’s important for the writer portraying their actions and emotions to understand their flaws and misgivings. Not so you can fix all of them to create the perfect person, but make sense of them to the reader or viewer.
A great example of a fictional work that draws attention to its characters flaws is the anime Aldnoah Zero. Note: I’ll be leaving names out of this to keep the article as spoiler free as possible for those wanting to watch, but if you want to go into the show totally blind you may want to avert your eyes.