Swartz wasn't the kind of person to accept a plea bargain from an overzealous prosecutor who was indicting him on 13 felony charges with a possible sentence up to 35 years along with a $1 million fine. I assume he wanted a trial because he wanted to continue his fight for open access. And maybe he thought he might lose, but wouldn't lose on all counts, and would make the prosecution look unreasonable in the public eye. Was that decision rational from a self-interest point of view? Maybe not.
And then you might ask, if he wanted a trial, why did he kill himself? Obviously no one knows what was going through his head when he did it. He left no note. But the prospect of being locked in a cell until he was an old man probably had something to do with it.
You can certainly argue it was his own fault for not pleading down, but even if that's your view, that doesn't absolve the prosecutor. Ortiz has a lot of blame in this too, and the fact she still hasn't acknowledged it over a decade later speaks volumes to the kind of person she is.