“The Internet’s Own Boy,” a documentary about the life and death of Aaron Swartz, premièred on Monday at the Sundance Film Festival, where it received a standing ovation. The life of Swartz as a coder and an Internet thinker is well known. A believer in free access to knowledge, in 2010 Swartz installed a computer in an M.I.T. supply closet and downloaded a large number of old academic articles. He was detected, caught, and charged by a federal prosecutor with thirteen felonies; in January of 2013, before his trial, Swartz killed himself. The documentary, shot in the course of that year, gives us relatively little new information about the legal controversy, but it is deeply revealing about who Swartz was.

The film confirms what everyone has said about Swartz—that he was difficult, foolish, and self-important in a way that is particular to smart young men, and that he was smart, idealistic, and vulnerable. He was one of those people who, beginning early in life, question everything, and notice how many of the answers are absurd. That instinct took him to the edge of society, like so many brilliant misfits, a disproportionate number of whom have created the American tech industry.

Swartz’s inability to adhere to social norms is well represented onscreen. For most of us, small talk and repetitious homework are mere annoyances, but for Aaron Swartz they were torture. As a freshman at Stanford, he preferred reading books to sitting with people in the dining hall, and, when asked if he was abnormal, told people that he found them abnormal for not preferring books. He left college after a year and helped to develop Reddit, but, after Wired’s acquisition of the site, he found that he couldn’t stand the absurdities of a work environment any more easily than those of college.

Almost as if he knew he would die young, Swartz found it hard to waste time on the kind of make-work and nonsense that forms so much of a normal life. And so he escaped from schools and office environments into the online world, where he could do something worthwhile: change the status quo, using code. As a teen-age programmer, he made serious contributions to RSS, and he helped Lawrence Lessig to code Creative Commons.

Many misunderstood loners seek to quit society altogether, but Swartz did not. He seemed to crave being understood, and the footage of him chatting and relaxing with his girlfriends make for the lightest scenes in the film. He could connect with other people, and many of those who knew him well loved him deeply, even if they found him impossible. Instead of moving to the desert, Swartz felt an urgent need to do something of public significance. Wherever that feeling comes from, it can be inescapable. While engendering an admirable idealism, it also created Swartz’s most unpleasant trait, an exaggerated sense of self-importance, which the film does not hide.

Mixing coding with a sense of public purpose, Swartz spent his short life launching one project after another—little code bombs designed, in ways large and small, to change the way the world is. He had the quintessential programmer’s instinct: If you notice something lousy or absurd, instead of just complaining, why not fix it? That instinct has catalyzed tech projects from the personal computer to the search engine; in Swartz’s case, the projects were political and social instead of technical. Among other things, he wanted to liberate information that he thought was wrongly imprisoned, make life safer for whistle-blowers, and fight political corruption. Some of his code bombs were duds, but others made a big difference. And, of course, one blew up in his face.

The footage of Swartz growing older and more handsome anchors the film, his stridency belied by his large, needy eyes. Swartz grew up in an age of total capture, meaning that there is video footage from most of his life—as a young boy climbing trees, as a precocious teen-ager sprouting facial hair, and as a scruffy young man speaking at political rallies. It is an intimate film, and by the end you feel that you know Swartz. The awareness that he will eventually take his own life makes it especially hard to watch him as a happy little boy, laughing and playing. The death is less a Hollywood drama than it is a slow-moving descent into despair, after Swartz is caught and charged, as Cory Doctorow puts it in the film, for “taking too many books out of the library.” A felony is a weighty thing for anyone, but Swartz, serious to a fault, saw conviction as a mark that would stain his life indelibly.

There is some commonality between Aaron Swartz and Christopher McCandless, who died in the Alaskan outback, the subject of Jon Krakauer’s book “Into the Wild.” Neither man could really accept the world, and both of them died young. But, unlike in McCandless’s case, the but-for cause of Swartz’s death was clear: a relentless federal prosecutor who piled on the felony charges and refused to drop them, despite the fact that the crime did no real damage, and that the database owner, JSTOR, had asked that the charges be dropped. Yes, Swartz took his own life, and he bears responsibility for that act. But, as the film shows, his prosecution was a cruel and unnecessary episode that is unworthy of a country that calls itself free.

Swartz’s suicide is so dark that the director Brian Knappenberger tries to end the documentary on a slightly positive note. As protestors march, he notes that the reform measure called Aaron’s Law was introduced in Congress in 2013. Its purpose is to improve the outrageous statute used to prosecute Swartz, the Computer Fraud and Abuse Act, which makes much of the American population potential felons and entrusts our continued freedom to prosecutorial forbearance. The ending may make the audience feel better, but Aaron’s Law, in reality, has gone nowhere, thanks to opposition by firms like Oracle and the Justice Department. The cloud, in this case, has no silver lining.

Congressional inaction is hardly news, but here the fault lies with the White House as well. The Obama Administration has considerable leeway for reform; as with the N.S.A.’s overreach, it could, at a minimum, hold a review of C.F.A.A. prosecution and consider some limits in how the law is used. But after holding a symbolic White House meeting last spring in response to an online petition, the Administration has done nothing. Aaron, I am sorry to say, has died in vain.

Read Larissa MacFarquhar’s Profile of Aaron Swartz.