This is entirely possible in a number of different motions that could have been made. At this point, Vinny had destroyed the Prosecutor's eyewitnesses by showing they had issues that called their testimony into question (The first has a timeline that doesn't line up with events, the second has poor vision and her prescription glasses were not doing their job, and the third had many obstructions blocking his view of the scene). His first witness tears apart the "expert" witness, who was only there to testify that the tires were the same brand (albeit, a popular brand at the time... loads of cars had the same tires).
While it might go by a different name in different jurisdictions, the Prosecutor is allowed to make a motion to dismiss at any point prior to the jury goes to deliberation (as is the Defense; Also they might be able to make motions while the jury is in deliberations).
If properly titled, the Prosecutor should have made a "motion for nolle prosequi" (not prosecuting). This can mean any number of things including the prosecutor no longer believes the evidence can prove the charges OR even that the prosecutor is no longer convinced that those charged committed the crime.
In the "My Cousin Vinny" case, as the jury was seated the case cannot be retried by the State of Alabama at this point.
This is possible because the Prosecutor's duty is to uncover the truth behind a crime, no matter what that truth becomes. In this case, despite his previous beliefs, the prosecutor in My Cousin Vinny, upon realizing he was wrong, admitted it and dropped the charges. Given his backstory of having worked as a defense attorney and making the switch after getting a client off some serious charges (and knowing the client was guilty) shows that he was inherently an honest man and dedicated to finding the truth of the matter (as a government employee, he undoubtedly took a pay cut when he switched to prosecution. Private industry almost always pays way more than a government equivalent). With that in mind, it is expected of prosecutors to be perfectly honest with what evidence they have and make the choices in the case based on that evidence. This comes up in another scene when Mona Lisa Vito explains to Vinny that the prosecutor was required to give Vinny all the files he had on the case... because Vinny, by representing the Defendant, is allowed to examine all evidence against his clients. The only dirty trick he pulled was the stunt where his expert witness was not disclosed and while bad, really it's the judge allowing the witness to testify that would have caused a problem with the trial (his response to Vinny's objection could have created a mistrial on appeal).
To give a real world example, I was charged with driving on a suspended license which I had no idea I was doing at the time. As it turned out, the license was suspended for an unpaid traffic ticket that I had paid in the last minute... essentially the DMV forgot to unsuspend. A quick call fixed that issue but I still had to go to court over the charge. The day of the trial, I show up in the court room and the prosecutor walks over and tells me that they were going to enter a motion of "nolle prosequi" for the charge... essentially dropping it... because the matter was a clerical error on the state's part and not anything I did wrong.
Edit: Additionally had the prosecutor not motioned to dismiss, Vinny certainly could have. In fact there are two points during the trial where Defense attorneys are expected to make these motions. The first is when the Prosecution rests their case. The second is before the jury is given the case to deliberate.
As for why it was called a motion to dismiss in the film, it's likely to due with the fact that the audience would not know what a "motion for nolle prosecui" and it is a type of motion to dismiss.