CANNES, France—Even before achieving stardom at an impressively young age, Will Smith learned a lesson that would end up shaping his career while taking decades to truly sink in.

It happened, he told a packed audience today at the Cannes Lions, when his grandmother found a notebook where the 12-year-old aspiring rapper was writing his first draft of obscenity-laden lyrics.

"My grandmother found my book that was laced with all my poetic profanity," he said on the conference's main stage. "She never said anything to me, but I came in one day and grabbed my book, and she had written in the back: 'Dear Will, truly intelligent people don't have to use words like this to express themselves. Please show the world that you're as smart as we think you are.'"

Her comment stuck with him and inspired him to be a "clean" rapper, a decision that helped vault him to fame as both a masterful emcee and as a TV star.

"She made me realize that I wasn't creating only for me," he said in the onstage interview with Edelman creative strategy chair Jackie Cooper. "The things I created were going to have an effect on her and were going to have an effect on everyone who came into contact with my artistry. It was such a blessing. At 12 years old, I realized I was connected to everybody else in the process."

Many years later, his grandmother's impact would be amplified by Smith's close friendship with Muhammad Ali, whom he portrayed in a 2001 biopic.

The two met at a precarious time in Smith's career. After a rapid succession of hits like Bad Boys (1995), Independence Day (1996) and Men in Black (1997), Smith admits he became less selective in his choices and was largely motivated by a thirst for fame.

"What happened is there was a big of a lag, a slump in my career—around the Wild Wild West time—where I found myself promoting something because I wanted to win, versus promoting something because I believed it was helpful," he said.

"I had so much success that I started to taste global blood, you know?" Smith said. "My focus shifted from my artistry to winning. I wanted to win. I wanted to be the biggest movie star in the world."

Humbled by the realization that audiences wouldn't love him unconditionally (Wild Wild West has a meager 17 percent "fresh" rating on critic review aggregator Rotten Tomatoes and barely eked out a profit on its $170 million budget), Smith said he realized that he needed to select movies that had more to offer than just a paycheck.

"When I read a movie script, it's not, 'Is this going to make a lot of money?'" he said. "I'm asking myself, 'How does this improve lives?' It doesn't have to be deep. If it's just comedy and people come to get a laugh, it improves lives."

He describes the change as a shift "from products to people."

"In making the shift from product to people," he said, "I am trusting that if I have a deeper comprehension of people, the product I create is going to be more successful."

Social media has tightened the timeline on audience disappointment or backlash even more today, Smith said, making it vital that he pursue projects he believes in, like 2006's Pursuit of Happyness and 2015's Concussion.

"That smoke and mirrors in marketing is over. It's really over. People are going to know really quickly, and they're going to know globally, whether your product is keeping its promises," he said.

"The power has gone away from the marketers. I consider myself a marketer. My career has been strictly about being able to sell my products globally. But the power has gone away. The power is now in the hands of the audience, in the hands of the fans. The only choice I have is to be in tune with their needs, not try to trick them into going to see Wild Wild West."