Bill Gates says he retired from Microsoft nearly a decade earlier than he intended—here's why

Bill Gates
Chesnot/Getty Images

For years, Bill Gates couldn't imagine doing anything besides running Microsoft, which he founded with Paul Allen in 1975 when he was still a teenager.

"If you'd have asked me in my twenties if I'd ever retire early from Microsoft, I'd have told you that you were crazy," he writes on his blog, Gates Notes.

He's the first to admit that, especially in the early days of the company, he was obsessed with building the business. "I loved being fanatic. I reveled in it," the self-made billionaire says in the Netflix three-episode documentary series "Inside Bill's Brain." "I didn't believe in weekends, I didn't believe in vacation."

But by the time he reached his mid-40s, "my perspective was changing," Gates says, and "my world view was broadening." In 2000, he and his wife, Melinda, launched their foundation, which works to reduce inequity across the globe. They transferred $20 billion of Microsoft stock to the Gates Foundation and started traveling abroad to study health problems in poor countries.

The more involved he became with the foundation, the more he realized that his future career wasn't going to center around building software products.

Watch 28-year-old Bill Gates explain why he didn't see himself as a genius

In 2001, Gates' good friend Warren Buffett invited him to speak to a group of business leaders about what he and Melinda and were learning on their foundation trips.

While speaking about global health that day, "I was energized," Gates recalls. "When ideas excite me, I rock, I sway, I pace — my body turns into a metronome for my brain."

"The speech helped me see more clearly a life for myself after Microsoft, centered on the work that Melinda and I had started," he continues. "Software would remain my focus for years, and I will always consider it the thing that most shaped who I am. But I felt energized to get further along this new path we were traveling."

Gates ended up retiring from Microsoft  "almost a decade earlier than I had planned," he writes, adding: "The 2001 speech was a step, a private moment, on the way to that decision."

It was "the day I knew what I wanted to do for the rest of my life."

Don't miss: Bill Gates listed pros and cons of getting married on a whiteboard—what that says about his relationship with Melinda

Like this story? Subscribe to CNBC Make It on YouTube!

Melinda Gates shares Buffett's advice and what she and Bill won't spend on