The film starts with the Polaroid photograph of a dead man. As the sequence plays backwards the photo reverts to its undeveloped state, entering the camera before the man is shot in the head. This is followed by sequences of black and white chronologically and color reverse-chronologically interspersed.
The black-and-white sequences begin with Leonard Shelby (Guy Pearce) in a motel room speaking to an unnamed telephone caller who is not shown on-screen. Leonard has anterograde amnesia and is unable to store recent memories, the result of an attack by two men. Leonard explains that he killed the attacker who raped and strangled his wife (Jorja Fox), but a second clubbed him and escaped. The police did not accept that there was a second attacker, but Leonard believes the attacker's name is John or James, with a last name starting with G. Leonard conducts his own investigation using a system of notes, Polaroids, and tattoos. As an insurance investigator, Leonard recalls one Sammy Jankis (Stephen Tobolowsky), also diagnosed with the same condition. Sammy's diabetic wife (Harriet Sansom Harris), who was not sure if his condition was genuine, repeatedly requested insulin injections to try to get him to break his act. As a result of these requests she overdoses, subsequently falling into a coma and dying.
The color sequences are shown reverse-chronologically. In the story's chronology, Leonard gets a tattoo, based on self-directed instructions, of John G's license plate. Finding a note in his clothes, he meets Natalie (Carrie-Anne Moss), a bartender who resents Leonard as he wears the clothes and drives the car of her boyfriend, Jimmy. After understanding his condition, she uses it to get Leonard to drive a man named Dodd (Callum Keith Rennie) out of town and offers to run the license plate to help his investigation. Meanwhile, Leonard meets with a contact, Teddy (Joe Pantoliano). Teddy helps with Dodd, but warns him about Natalie; Leonard finds a photo written to not trust him, however. Natalie provides Leonard the driver's license, which shows a John Edward Gammell, Teddy's full name. Confirming Leonard's information on "John G" and his warnings, Leonard meets Teddy and drives him to an abandoned building, killing him as shown in the opening.
In the final black-and-white sequence, prompted by the caller, Leonard meets Teddy in the motel lobby. Teddy is an undercover officer and has found Leonard's "John G," Natalieâs boyfriend, Jimmy Grantz (Larry Holden), and directs Leonard to the same abandoned building outside of town. When Jimmy arrives, Leonard strangles him and takes a photo of the body. As it develops, the black-and-white transitions to color, thus beginning the color sequences. Leonard swaps clothes with Jimmy, hearing Jimmy whisper "Sammy." As Leonard has only told Sammy's story to those met, he doubts Jimmy is the attacker. Teddy arrives and asserts that Jimmy was John G. But when Leonard is not convinced, Teddy reveals that he helped Leonard find and kill the real attacker over a year ago, and he has been having Leonard kill troublesome people for him ever since. Jimmy was a police officer who was investigating them. Teddy points out that since "John G" is a common name, he will continually forget, beginning his search again and that even Teddy himself has a "John G" name. Further, Teddy claims that Sammy's story is actually Leonard's, and he has repressed the memory in order to escape his guilt.
After hearing Teddy's exposition, Leonard consciously burns Jimmy's photograph, drives off in Jimmy's car and has Teddy's license plate number tattooed on himself as the one of the second attacker, which will lead to the events of Teddy's death.

Question: Who is Teddy?
Answer: An undercover officer who was trying to help find out name of the second attacker.
Alternative answer: An undercover police officer.