Any given intern (or any other candidate) applying to any given company may not actually know much at all about the topic at hand. In some cases they may get through the interview process even though the company wouldn't want to have hired them had they known what their level of knowledge was. In other cases the company may see it as more of a teaching experience for the intern where the benefit to the company can be much smaller (and the benefit may not even be about the work the intern does at all). So I don't think it would be entirely unexpected nor necessarily problematic to occasionally run into an intern that's "totally incompetent", as you say.
There are basically 3 solutions to the problem, in order of preference:
Fix the problem
You've already tried to do this, but I feel I should add a few things.
Dictating code to someone teaches them very little and doesn't help that much with allowing them to figure out the solution to the next problem by themselves. An explanation of code is more helpful, but at times it can also be quite hard to follow that and to not really remember what's been explained, even if you understand it in the moment. Explaining your thought process (as in how you actually come up with the code, instead of what the code does) could be more helpful.
But what I would generally suggest instead is to ask lots of questions and to try to lead them to the solution instead of just explicitly telling them the solution (or at least doing so where it's realistic to do so).
I see 2 main problems that make people struggle with learning programming:
The inability to break down problems. This is probably what I see most often from people who are struggling with learning programming. This is more a problem of thought processes and can't really be solved by skipping straight to the answer. If I can't figure out directions to get somewhere, telling me how to get there does help with the immediate problem, but I wouldn't know how to figure out directions to get somewhere else (other than to ask you). You need to address the thought process directly.
How do they break down a vague problem into high-level steps of what code needs to do? How do they break down those high-level steps into actual lines of code? How do they "break down" the problem of "I don't know how to do a thing" into a series of steps that would lead them to knowing how to do the thing (which may include Googling it)?
Asking them questions and letting them actually do things by themselves (under your supervision) helps them to break problems down, since you can ask them directed questions in a way that breaks the problem down in ways they can easily replicate in future and you can fill in any gaps in their ability or knowledge along the way.
If they often struggle with things one can easily answer with a Google search, you can ask how they'd solve the problem if you weren't there. If they can't get there themselves, you can suggest that they Google it (ideally with you watching, e.g. via screen-sharing). If they can't figure out the right thing to Google, you can potentially ask them how they'd ask you the question.
It can often help to put aside the programming context and put the problem into a real-world perspective (if possible). You want to find the smallest element in an array and you don't know how. Okay, here's a row of balls. Find the smallest one. Even a relatively small child should be able to do that and being able to turn that into code in a high-level programming language often requires little more than the knowledge of the syntax and functions of the language. Of course it isn't always an exact translation and you might need to add constraints so they come up with a solution that would actually make sense in a programming context.
The lack of knowledge of specific programming concepts, functions, syntax, etc. This has a fairly straight-forward solution: make them aware of those things. Now if they don't know anything at all about programming, it may be an unreasonable burden to expect you to teach them all of that. They could also learn it by themselves if they're pointed to appropriate learning resources, which may or may not take too long for the purposes of an internship. Whether it would take too long is something you'd need to judge for yourself.
Get rid of the problem
If you have an employee who isn't performing well enough, and you've tried sufficiently hard to fix the problem, the next step would be to fire them.
However, as noted above, an intern's lack of ability to get much done by themselves may not actually be considered a problem for the company and thus wouldn't be a reason to fire them. Also, firing interns for performance reasons (especially when they're trying) may be frowned upon, as internships don't typically last that long, the firing process could take a while and firing them may generally be seen as not worth the trouble. If you personally don't know whether it would be appropriate here, your manager could advise you on that.
The typical manager can often just fire an employee by themselves, or at least start that process with HR (although different jurisdictions have different laws that may affect this).
If you're not yet at the stage where you can do that yourself, you'd probably need to speak to your manager about it. If they're a good manager, they'd first discuss and offer suggestions to fix the problem instead.
I wouldn't phrase it as "we need to fire this intern", but rather "how can we solve this problem". In general it's good to propose a solution when bringing your manager a problem (and it may be good to mention firing here), but I'd be cautious to avoid making it seem like that's the first place you'd turn when dealing with poor performance.
And don't tell your manager the intern is "incompetent". That's a rather negative sentiment and some may consider it a personal attack. Instead just stick to the facts of what they know and don't know, and can do and can't do, and whether you think they're actually capable of doing the job.
Ignore the problem
Maybe there just isn't much you can do to either fix or get rid of the problem. At that point the only option would be to just ignore the problem to whatever extent possible and practical (or keep trying to fix it).
Find work for them to do that they are capable of doing without much assistance, have them shadow you or just continue spending a lot of time hand-holding them to do the work that needs to get done until their time at the company runs out.
But this wouldn't be my preferred way to solve the problem.
What about the interview process?
You could find out what the interview process currently is, and suggest changes to that, and maybe you can present this employee as an example of why that's needed. But hiring one bad employee doesn't mean the interview process is bad. It doesn't mean the person who conducted their interview is incompetent. It's not something you should specifically go and investigate because of this one decision.
Interview processes are imperfect and some bad decisions will happen.
If you're basing this on a single bad decision, that would be questionable. You need quite a lot of data, or a sound independent argument, to actually conclude that the interview process is bad. For example, do not say "we should give candidates a coding test because that would've prevented us from hiring this one employee". But you might be able to say "we should give candidates a coding test because that's a good way to evaluate their coding ability and prevent us from hiring candidates who can't code (like this one employee)". Although someone might rightfully disagree with your premise that hiring candidates who can't code is currently a problem that needs solving for the company, if the only evidence of that is one intern who can't code. You may be able to approach the argument from other angles though.