Iruka's parents were killed twelve years before the start of the series, defending Konoha from the Nine-Tailed Demon Fox. Initially, he was present on the battle field, telling his father he wouldn't leave, but stay and protect his mother. His father shouted at him that it was the parent's duty to protect the child. He was later forcibly removed from the battle field by an unknown shinobi. With his family gone, Iruka had no one to give him attention. Iruka thereafter became a prankster like Naruto, trying to gain attention to stave off his loneliness. He would spend his time at the monument where his parents' names were engraved, and, in his darkest moments would be cheered up by the Third Hokage. Mizuki was a childhood friend of Iruka's after the Nine-Tails Attack, and usually made him feel better. It later turns out, due to other people giving Iruka more attention than they do to Mizuki, Mizuki's kindness to Iruka revealed to be an act just to gain the Hokage's approval, all the while making Iruka miserable discreetly.
In the anime, Iruka was shown to have become a teacher because he wanted to pass on the Will of Fire to the next generation, inspired by the Third Hokage's wisdom. When Naruto became his student, he found it awkward to deal with the very monster responsible for his parents' death. He tried to ask the Third Hokage if he could not teach Naruto, thoughhe was eventually disabused by the notion by his former mission commander, Kakashi Hatake. Later, Naruto went into the woods to steal items from corpses. Iruka chased him down and protected him from Takigakure spies who were attacking Naruto, eventually backed up by Kakashi. After saving Naruto and bringing back the document attached to the artifact the latter retrieved, he thanked the Third for assigning Naruto to him. He thus resolved to be straightforward and deal with Naruto strictly in class from then on, in order to train him to become a fine shinobi.Although he owes much of his miserable childhood to the Nine-Tails, he has no hostility towards its container, Naruto Uzumaki, and even cares for him as family. Early on in the series, he relates to Naruto's efforts to win the recognition of others through his antics; a tactic that he also used in his childhood to cope with his feelings of loneliness, which he can sense in Naruto.
Because of this, Iruka goes out of his way to connect with Naruto outside the classroom — having realized that he could do more good as a mentor, than as a teacher. Iruka becomes even more aware of Naruto's situation when the Third Hokage asks him to contemplate living among people who would deny his very right to exist. Likely due to Iruka's more nurturing and compassionate nature, Naruto views him as a father-figure. The two enjoy their favorite ramen dish at the Ichiraku Ramen Bar whenever Naruto returns from a mission, where Iruka gets an opportunity to see how Naruto is developing as a ninja. Iruka's refusal to allow Naruto to graduate at first was not out of spite, but merely out of caring strictness and a desire for Naruto to work harder and reach his own potential.