Dozens of American envoys will leave office next week, but few of them are as prominent as Ms. Kennedy, the daughter of President John F. Kennedy. Over the last three years, she helped manage relations with one of America’s most important allies, but her status as the first woman to hold the post may have been just as consequential for traditionally male-dominated Japan.

“I just think being a woman ambassador, and I think visible women in positions of leadership, does help change attitudes,” Ms. Kennedy said in an interview this month in her office at the United States Embassy in Tokyo.

The historic nature of Ms. Kennedy’s tenure is evident in an alcove down the hall from her office, where 30 portraits of past American ambassadors hang in three neat rows. Going all the way back to Townsend Harris, the first envoy to Japan in 1856, they are all men.

In Japan, where few women hold positions of authority and married women cannot use their original surnames, Ms. Kennedy, a trained lawyer and mother of three, was a role model for combining power and family as well as a vital supporter of the agenda of Prime Minister Shinzo Abe, who has said he wants women to play a larger role in business and politics.

Her influence as ambassador stemmed from who she was — not just a woman, but the daughter of President Kennedy, a beloved figure here as he is in the United States.