A plea bargain occurs when the defendant and the prosecutor reach an agreement where the defendant pleads guilty to a lesser charge for a lesser sentence or so other charges are dropped.
You can make a plea bargain at any point in the criminal case in most states, though it’s often done before going to trial.