Badly written character. Usually due to ignorance of author, or general lack of skill, but could be badly written on purpose for various reasons.
It doesn't necessarily mean character being overpowered, stories can be made with overpowered protagonist without said protagonist being Mary Sue / or Gary Stu, as male counterpart.
Badly written character is EXACTLY what a Mary Sue does NOT define. Power level and level of influence, as well as accomplishments, have everything to do with it.
Being badly written is usually just a side-effect of all that. You can have a badly written character who gets their shit kicked in all day, and that would not be a mary sue.
Let it then also be noted that a charming and clever character is not a badly written one, but can still be a Mary Sue, so as to suggest that you can enjoy seeing or hearing the banter of said character while acknowledging they are a Mary Sue.
For example, Classic Lara Croft, from the older Tomb Raider games and the first three movies. She is charming, witty, and strong. Listening to her quips and insults as she casually engages in large scale gun battles and foils ancient evils is endearing, yes.
But what she accomplishes, how she literally shapes the universe by doing nothing more than joking and quipping in a sarcastic and witty manner, all while using only her guns and wits, and sometimes an ancient magical artifact which she just so happens to possess in her long library of ancient magical artifacts that she possesses, just shows how much of a Mary Sue she is.
This is a woman who stared a dark, evil spirit down in the eyes, and escaped it as she dared it with her dual pistols. Dual pistols, I repeat.
Contrast that to the modern day take of Lara Croft, a woman who had to struggle to gain all that she had accomplished and who fought through the harshest of natural environments and physical threats to accomplish her task of survival, and which sounds more satisfying?
The woman who, after surviving three days on a deserted island and was forced to fend for herself against savages and rapists, ended up scaring all of them away with self-assembled bows, bombs, a pickaxe, and stolen assault rifles?
OR
The woman who used her expertized marksmanship skills which are beyond the likes of all men to take down a man wielding a literal God's Blade, and then used the God-Blade to kill a God, all while giving a casually cheerful face?
One of those is a well-written, and well-believable character. The other is a Mary Sue.
Let us define a Mary Sue then.
A Mary Sue is a character who can break all the conventional rules of their universe to perform outlandish or incredible accomplishments. And they do this on a regular basis too, basically ignoring any of the struggle that a real person (or at the least, a person in that universe) would have in order instantly get to that satisfying conclusion.
Except, without the struggle, the conclusion is not satisfying.
This means that, whereas usually well-written characters can have the journey of a thousand miles start with a single step, the Mary Sue won't have to begin the Journey of a thousand miles, because the end destination just ran towards them.
Or otherwise:
Normal characters must adhere to the rules of the universe, but the Mary Sue shall bend the rules of the universe, and with that, the narrative, to their liking. Whether that be through birthright, or bad writing, it matters not.
Usually, signs of a Mary Sue are that they have no flaws, or that if they do have flaws, that these flaws are minor things such as being too clumsy, too trusting, or, GET THIS, too pretty! Very minor or even inhuman flaws which few people have.
Some notable examples of Mary Sues:
KIRITO
Lara Croft
Naruto (YES.)