“The Wire,” HBO’s five-season epic of Baltimore life, is a perennial contender for the greatest television series ever, and Michael K. Williams, in his role as the stickup man Omar Little, its most memorable actor. But on the show’s first day of filming, when a prop person handed him his character’s signature shotgun, Mr. Williams clutched it with a look of sheer bewilderment.

“He didn’t know which end was which,” said David Simon, the creator and showrunner of “The Wire.” “Mike is a beautiful man, but a gangster he is not.”

Mr. Williams would not be deterred. Later that week, he left the set in Baltimore and returned home to East Flatbush, Brooklyn, and enlisted a local drug dealer to help hone his craft. Standing on the roof of the Vanderveer Estates, the man walked him through the particulars of firearms by spraying a hail of pellets into a steel door.

“Best acting lesson I ever had,” Mr. Williams said.

In the years since then, Mr. Williams, 50, has continued to draw inspiration for his characters from the world of Vanderveer, a housing complex now known as Flatbush Gardens, where he lived for much of his life. Time and again, his work has returned to the complicated intersection of race, masculinity, crime and institutional failure. After Omar, he was Chalky White, an Atlantic City bootlegger in “Boardwalk Empire” who reminded Mr. Williams of his father; then, in “The Night Of,” Freddy Knight, a Rikers Island inmate like his nephew Dominic Dupont; and Ken Jones, a gay rights activist in “When We Rise,” whose battle with H.I.V. paralleled that of another nephew, who died.