The actor has been interviewed for the first time since the incident, which he described as "a horrific night".
Appearing on The Daily Show with Trevor Noah, he said: "I was going through something that night, you know?
"Not that that justifies my behaviour at all." Smith added that there were "many nuances and complexities to it", but added: "I just - I lost it."
Smith stormed the stage at the Hollywood award ceremony after Rock made a joke about Smith's wife Jada's shaved head. She has the hair loss condition alopecia.
"I understand how shocking that was for people," he told Noah. "I was gone. That was a rage that had been bottled for a really long time."
He said he also understood the pain he had caused, and recalled the reaction of his nine-year-old nephew that night.
"He's the sweetest little boy," Smith said. "We came home and he had stayed up late to see his Uncle Will, and we're sitting in my kitchen, and he's on my lap and he's holding the Oscar, and he's just like, 'Why did you hit that man, Uncle Will?'
"It was a mess."
The interview on the late-night US TV talk show was the first time Smith had been publicly challenged about the attack.
Smith told Noah he understood the often-quoted theory that "hurt people hurt people".
Discussing the background to his Oscars assault, the actor said: "It was a lot of things. It was the little boy that watched his father beat up his mother, you know? All of that just bubbled up in that moment. That's not who I want to be."
Smith has opened up before about growing up in an abusive home. His autobiography begins with a harrowing description of his father attacking his mother - an incident he said defined his childhood, and ultimately led to his career.
Discussing the reasons for the slap, he said: "I guess what I would say is that you just never know what somebody's going through," without elaborating on what he was referring to.
Addressing the studio audience, he continued: "In the audience right now, you're sitting next to strangers, and somebody's mother died last week. You know? Somebody's child is sick. Somebody just lost their job. Somebody just found out their spouse cheated.
"There's all these things, and you just don't know what's going on with people. And I was going through something that night."
In the aftermath of the Oscars, he has "had to forgive myself for being human", he said.
"Trust me, there's nobody that hates the fact that I'm human more than me... I've always wanted to be Superman. I've always wanted to swoop in and save the damsel in distress.
"And I had to humble down and realise that I'm a flawed human, and I still have an opportunity to go out in the world and contribute in a way that fills my heart and hopefully helps other people."
The 54-year-old has been banned from attending the Oscars for 10 years, and has also resigned from the Academy, which organises the ceremony.
In July, he posted a video on YouTube, answering questions that appeared to be written by fans about the Academy Awards. Prior to that, he had only issued written statements about the altercation.
He appeared on Monday's episode of The Daily Show to promote his new film Emancipation, to be released next week, making it eligible for next year's Oscars.
Smith, who received this year's best actor award for King Richard after the slap, said the idea that his new the film would be "tainted" during the forthcoming awards season by his actions was "killing me dead".
"These top artists in the world have done some of the best work of their career," he said. "I hope that their work will be honoured, and their work will not be tainted based on a horrific decision on my part."
Watch: Will Smith acknowledges that Oscar slap was wrong