It turns out that the true-story bit about “Dog Day Afternoon” was, well, pretty true. That’s one of the jaw droppers in “The Dog,” an absorbing, rollicking documentary about John Wojtowicz, who’s best known as the guy Al Pacino played — with heart, soul and a river of flop sweat — in “Dog Day Afternoon.”

In Sidney Lumet’s 1975 classic, Pacino portrays Sonny Wortzik, whose new career as Clyde Barrow goes south as soon as he pulls out a gun in a Brooklyn bank. Thwarted by bad planning and legions of cops, Sonny eventually ends up in cuffs. The same pretty much happened to Wojtowicz, except that he was immortalized in a Hollywood masterwork.

Directors Allison Berg and Frank Keraudren begin their story with Wojtowicz, whom they met in 2002. He was in his late 50s, a small man with an accent straight out of Brooklyn. As the world came to know, he was somewhat of a romantic.

In 1972, when Wojtowicz took over a Brooklyn bank, he wasn’t yet the Dog. He was just Little John, a Vietnam veteran, a father and a husband. He was also 27 and separated from one wife, Carmen Wojtowicz, with whom he had two children, and having problems with a second, Ernest Aron aka Liz Eden, a transgender woman.

What might have been just another ho-hum heist turned into headline news when, shortly after the police descended on the bank, Wojtowicz announced that he wanted Eden released from a psychiatric ward. “I’m gay,” Wojtowicz explained. “When I get Ernest back, then I’ll release one of the hostages.” Pandemonium ensued, and the crowd outside the bank swelled to an estimated several thousand.

Drawing on extensive interviews and digging deep into archives, Berg and Keraudren revisit the bank robbery while doing so much more.

“The Dog” is, as its title suggests, a documentary portrait, but it’s also an exploration of that sometimes messy thing called identity. Part of what makes Wojtowicz such a fascinating character is that he seemed to rotate identities as easily as other people change socks, and without angst. At one point, he campaigned as a Goldwater Republican; not too long afterward, he was agitating with the Gay Activists Alliance.

His transformation from activist to outlaw appeared equally seamless.