Photo: Dita Alangkara, Associated Press Photo: Cameron Spencer, Getty Images Photo: Clive Brunskill, Getty Images Photo: GRANT HINDSLEY, SEATTLEPI.COM

The Bay Area has showcased many of sports’ biggest stars, but there’s one legend who has eluded us.

Until now.

Roger Federer will play his first match in the Bay Area on March 5 at San Jose’s SAP Center.

The event, titled “Match for Africa 5 Silicon Valley,” is a fundraiser for the Roger Federer Foundation, which provides access to education for children in South African countries. It’s a chance for fans to see perhaps the greatest tennis player in history, in a relaxed environment, raising money for a good cause.

“We want to go places where people really enjoy tennis, and where it might sell out,” Federer said recently by phone from Melbourne, Australia, where he is attempting to defend his Australian Open title. “Everybody has a lot of fun.”

Federer, despite a standing invitation, did not play in the SAP Open, which was held in San Jose until 2013. As with many Europe-based players, it was difficult to fit into his travel schedule. He has not been to San Francisco. His only trip to the Bay Area was a one-day visit to Google.

He has legions of fans here. But unless they traveled, they haven’t seen him play in person. Federer is 36, so opportunities might be running out.

Federer, however, isn’t looking at retirement.

“Not yet,” he said. “I plan to stay for a bit longer. Things are great.”

About as great as they’ve ever been. Federer called last year his most fun ever and the 2017 Australian Open perhaps the most satisfying victory of his career. He was coming off an injury-plagued 2016 and he hadn’t won a Grand Slam since Wimbledon in 2012. There were whispers that the end was near.

“I wasn’t sure how much was left in the tank, if I would ever get back to winning ways,” Federer said. “It was the first time I was on crutches. It was scary, to be honest.”

What happened next was “incredibly unexpected.” Unlike past years, when he entered competition as a top seed, Federer approached the Australian Open with the only goal of getting through his first-round match healthy.

“I kept my expectations so low,” he said. “And then it was a fairy-tale beginning to the year.”

Photo: Darrian Traynor, Getty Images

Federer beat Rafael Nadal in five sets to win the title. The dramatic fifth-set comeback, when Federer faced down two break points, gave him his 18th Grand Slam title. He was giddy after, carrying “Norman” — the Norman Brookes trophy the male champion wins — everywhere with him. Federer won Wimbledon last summer.

The experience, along with the wisdom that comes with age, has allowed him to savor his career in ways he couldn’t when he was younger.

“When I was really dominating, it was a fast time,” he said. “It was incredibly exciting, learning about organization and professionalism. But I hardly remember certain matches. It was a blur, too much all at once. I’ve had to slow things down.”

Federer attributes the slower pace to his four children, twin 8-year-old girls and twin 3-year-old boys.

“You have to stay in the moment when you have kids,” he said. “They’re the priority.”

Federer has his priorities straight. One of the most gracious athletes of the modern age, he is also a dedicated philanthropist. He launched his foundation in 2003, just as his meteoric rise was beginning.

“I asked myself the question, ‘What do I want to do beside play tennis?’” he said. “I wanted to do something on my own, not just donate a racket. I wanted to do something that could leave a legacy.”

He chose to base his work in South Africa, where his mother was born. He started small and grew. By the end of this year, he plans to meet his goal helping 1 million children. He chose education because he knew that many children didn’t have access to the type of education he took for granted, growing up in Switzerland.

“An early childhood education is really a priority,” he said. “I see it with my own children.”

Federer’s charity work has raised large sums for other regions, such as Haiti. We spoke shortly after President Trump’s comments about Haiti and Africa.

“You don’t have any power over where you’re born,” Federer said. “You have to try to fight your way out of poverty. And through education, you’re much better off.”

Federer will play Jack Sock in the March exhibition. Federer wants to feature an American player. In last year’s Match for Africa Seattle, which raised $2 million for the foundation, he played John Isner. As he did in Seattle last year, Federer will play a doubles exhibition with Bill Gates as a partner (this time against Sock and “Today” host Savannah Guthrie).

“Playing in front of 16,000 people definitely made me a little nervous,” Gates wrote in an email. “I’ve been playing since I was a little kid. Ahead of the match I put in some extra practice. I don’t think I missed a first serve which I feel good about.”

Photo: GRANT HINDSLEY, SEATTLEPI.COM

Gates admires Federer, as both a player and a philanthropist.

“It’s important for people to see progress like this and hopefully be inspired to act in their own way,” Gates wrote. “It can be hard to tell, when you read the headlines every day. But when you take a long view of things, the data clearly shows that the world is getting better.”

Federer’s journey in Melbourne this January is quite different from last year’s. As defending champion, he arrived with expectations, which have grown only as the field has been reduced. Andy Murray withdrew before competition, both Novak Djokovic and Stan Warwrinka were defeated and Nadal had to retire during the quarterfinals, meaning no rematch of last year’s epic between the rivals.

“At my age, you have to be cautious of predictions,” said Federer, who beat Tomas Berdych in straight sets in a quarterfinal match on Wednesday to reach the semifinal.

His Melbourne experience has included an on-court interview with Will Ferrell, who compared him to “a silky gazelle.”

Federer played along.

“Don’t they get eaten at the end?” he quipped.

“Tennis is supposed to be fun,” Federer said. “I savor moments much more now.”

Finally, the Bay Area will get a Federer moment to savor.

Ann Killion is a San Francisco Chronicle columnist. Email: akillion@sfchronicle.com Twitter: @annkillion

Match for Africa 5 Silicon Valley

What: A benefit match between Roger Federer and Jack Sock, and a doubles exhibition with Federer and Bill Gates against Sock and Savannah Guthrie

When: 7 p.m. March 5

Where: SAP Center

Tickets: Starting at $30. On sale 9 a.m. Friday at the SAP Center Box Office, Ticketmaster.com, or charge by phone at (800) 745-3000.

Note: Also available are a limited number of VIP ticket packages, which include the opportunity to participate in a Q&A session with Federer and Sock prior to the night’s matches.