But Mr. Bryant remembered his high school experience for more than just basketball. He stayed in touch with the community, including Ms. Mastriano, whom he once called his “muse.”

In high school, she taught him the work of Joseph Campbell and the mythology of the hero’s journey, a concept that Mr. Bryant would return to in media interviews over the years.

After his basketball career began to take off, Ms. Mastriano recalled, he returned to the school to visit at times, slipping quietly onto campus and knocking on her classroom door.

No matter how much time had passed, Mr. Bryant, who lived in Italy for part of his childhood while his father played professional basketball there, greeted his teacher the same way. “He always called me Mrs. Mastriano,” she said, and not by her first name. “He actually put a really nice Italian spin on it.”

In one of his last interviews, Mr. Bryant credited Ms. Mastriano for planting a seed for his post-N.B.A. interest in the written word. In 2015, he announced his impending retirement in a poem titled “Dear Basketball,” and later won an Academy Award for an animated short film created around his reading of the poem. He was also getting ready to introduce a new book.

“She was so good and so passionate about what she was teaching about writing and storytelling,” Mr. Bryant told USA Today in an interview published last week. “She firmly believed that storytelling could change the world. And she opened my eyes to this passion I didn’t know existed.”

Ms. Mastriano said that Mr. Bryant had emailed her a copy of the poem after it was published, asking what she thought. She told him, “I wouldn’t change a thing.” She even shared it with her students. “I said, ‘See? This is what happens when you free write.’”