In general:
As @lynfromnm (Have you been away for awhile? I haven’t seen you in forever.) said, the prosecutor represents the state (or federal prosecutors represent the US government) in criminal trials against defendants.
Part of their job is based on bringing charges against those arrested or accused of crimes and driving investigations to build the case. In addition, they often negotiate with defense attorneys for plea bargains, or for exchanges of “bigger fish” for “reduced charges”. For example, any prosecutor would gladly reduce a relatively minor charge for theft, drug use, disturbance of the peace, etc., for an assault conviction of a “worse” defendant, or especially a capital or other infamous crime such as a major robbery.
In some cases prosecutors also conduct Grand Jury “investigations” into crimes and alleged crimes (pretty much running a dog-and-pony show for a select audience) to have an indictment handed down (to him, for a targeted defendant) rather than making a case to a judge for the same thing. That, I don’t quite understand myself.