David Ayer wrote the first draft in 1995, way before the Rampart Scandal made headlines in 1998. In the first draft, Alonzo was a Latino officer in charge of drug enforcement in the gang infested area of Pico-Union within the Rampart Division. He was a loner and didn't have any partner because of his reputation as a corrupt and racist cop. But the basics elements of the character were there: he wears expensive jewelry and drives a 1979 Monte Carlo model.
During the scene when Jake plays cards with the Latino gangsters, director Antoine Fuqua gave certain instructions to the actors playing the gangsters, without telling Ethan Hawke. This was done to further confuse him and add to the tension of the scene.
When the movie came out, many viewers and critics were skeptical of the scenes where Jake Hoyt smokes marijuana laced with PCP and Alonzo's explanation of how a cop who didn't take drugs offered to him on the street would be ID'd as police and murdered. David Ayer responded in an interview by holding up a highlighted section of the LAPD's rules and regulations; it stated that officers were allowed to use narcotics in very specific undercover situations, and hewed closely to what Alonzo told Jake.
T. Rodgers, the founder of the Black P. Stones Bloods in Baldwin Village a.k.a. The Jungles in Los Angeles, was on set for all of the filming in his neighborhood and allowed the producers to use his neighborhood in exchange for casting gang members.
Tobey Maguire was seriously considered for the part of Officer Jack Hoyt. He even followed Undercover Narcotics officers in Los Angeles for two months and gained weight for the role. He was dropped when Ethan Hawke, Fuqua's first choice, was finally available for the shooting schedule.
Before Antoine Fuqua was involved in the project, Davis Guggenheim was set to direct with Samuel L. Jackson as Detective-Sergeant Alonzo Harris and Matt Damon as rookie Officer Jack Hoyt. When Denzel Washington accepted the role as Detective-Sergeant Alonzo Harris, Guggenheim was replaced per his request.
The film had several police technical advisors. Among them is Detective-Sergeant Brian Davis, an LAPD veteran who is one of the most respected and decorated officer of the infamous elite Special Investigation Section.
Alonzo's car is a 1979 Chevy Monte Carlo, with some modifications: it has Dayton wire wheels with bullet caps; a Grant steering wheel; Flowmaster exhaust; and hydraulics. Added to this, the car is outfitted with a sunroof, which that era's Monte Carlos never had.
Alonzo's weapons of choice in the film are the venerable Smith & Wesson 4506, of which he carries two in a dual shoulder holster. The 4506 is a .45 ACP semi automatic [previously] used by many police departments around the country.
Although not shown in the film, the producers of the movie asked if the Angelus Temple cross, a famous Echo Park landmark could be used in the film. When the church declined, they brought in a "fake" cross and using a crane hoisted it up a few feet in front of the real Angelus Temple.
The original ending of the script was Hoyt crashing the pad of Alonzo's girlfriend and find his training officer in the middle of an orgy with two young women. Hoyt shows him the money that Smiley was supposed to deliver to the Russians and tells him that there is a crew of hit men looking all over for him. Alonzo then commits suicide in front of Hoyt.
During the movie, Hoyt often does the opposite of what Alonzo tells him to do. He tells Hoyt not to get involved with anything but organized crime and avoid wasting time with small crimes but he helps the girl who is getting raped (which eventually saves his life), he tells him never to mention his family while working but he says he's married and has a daughter when he's about to be shot in the tub, he tells Hoyt never to enter the rough neighborhood "Jungles" without him but he does (which eventually helps him catch Alonzo).