Trainspotting follows a group of heroin addicts in the late 1980s in an economically-depressed area of Edinburgh, Scotland, and follows the passage of their lives. Heroin addicts Mark Renton and Daniel "Spud" Murphy are running down Princes Street, a major retail area, and are pursued by store security guards. Renton's circle of friends are introduced; con-man Simon "Sick Boy" Williamson, good-natured Daniel "Spud" Murphy, athletic Tommy MacKenzie and psychopathic Francis "Franco" Begbie. They travel as a group and are driven by their heroin addiction.
Renton decides to quit heroin and to ease this transition he devises his own program, purchasing opium rectal suppositories from dealer Michael Forrester. After this hit he is struck by a violent episode of diarrhea caused by a sudden cessation of heroin. Renton locks himself into a room at a cheap motel to endure withdrawal. Later he finds his sex drive has returned and he goes to a club with his friends where he meets a young woman called Diane. They leave together and Renton goes home with Diane. They have sex and Renton stays for the night but is horrified the following morning when he discovers that the young woman is actually a fifteen-year-old schoolgirl and worse still, her "room-mates" are in reality her parents. He tries to put the incident behind him but this is not what Diane has planned at all, and rather than putting his trust with Diane behind him he is forced to keep in touch with her when she starts to blackmail him.
Renton, along with Spud and Sick Boy, start to use heroin again, and because his girlfriend has just dumped him after a chain of events caused by Renton, Tommy starts using as well. One day the group's drug-induced stupid is sharply interrupted when their heroin-addicted friend Allison finds that her young daughter Dawn has died of neglect and none of the group noticed. They are mortified but Sick Boy is hit especially hard as he is Dawn's implied father.
Renton and Spud are caught stealing from a book store and are arrested but whilst Spud is given a custodial sentence Renton avoids punishment by entering a drug intervention program where he is given methadone. Despite support from his family , Renton is desperate for a better "high" and escapes the program, fleeing to his dealer's home where he almost does of an overdose. His dealer puts him in a taxi and sends him to the hospital. When he is free to leave the hospital Renton's parents take him home, locking him in his childhood bedroom to force him to go through withdrawal. As his symptoms become more severe he has nightmares and hallucinates Diane standing on his bed singing, Allison's dead daughter crawling on the ceiling and an imagined television game show where the Host asks his parents detailed questions about HIV.
Renton's parents finally rouse him from these nightmares and they tell him he should get tested for HIV. Despite years of sharing needles with fellow addicts he tests negative. Depressed and bored, Renton visits Tommy who has become severely addicted and is HIV-positive. He is also becoming very ill. Renton moves to London and takes a job as a letting agent with a real estate company. Surprisingly he finds that he is enjoying his new, sober, drug-free life and saves up money whilst still corresponding with Diane.
Begbie and Sick-Boy move into Renton's studio apartment unannounced which irritates Renton, especially as Begbie has committed an armed robbery and Sick-Boy has become a pimp and a drug dealer.
Back in Edinburgh, Tommy passes away from HIV -related toxoplasmosis so the three travel back to Scotland for his funeral. Once there they meet Spud who has been released from prison. Sick Boy suggests they pull off a lucrative but highly dangerous heroin transaction but he needs Renton to provide half of the £4,000 up-front deposit. Renton injects himself with a sample of the heroin to test it's purity. The four sell the heroin to a dealer for £16,000. During their celebrations at the local pub, Renton takes Spud aside and suggests they steal the money back but Spud is too frightened of Begbie to even consider it. Renton witnesses Begbie slashing a man with a broken glass and then beating him for nothing more than accidentally spilling a beer on him and realizes that he has finally had enough of his psychopathic friend. As the others are still sleeping the following morning, Renton quietly takes the money. Spud sees him leave but says nothing to the others. When Begbie wakes up he destroys their hotel room in violent rage, his rampage attracting attention from the police. Spud and Sick Boy flee the scene. Renton stays true to his bow to live a stable, "ordinary" life. He also leaves Spud £2,000 so that he can try to do the same.