A few years ago Whole Foods Market decided that organic food didn’t go far enough. Never mind that organic is the upscale supermarket’s largest product category, accounting for 25,000 items on its shelves. Never mind that co-CEO and co-founder John Mackey is almost surely the individual most associated with today’s organic movement and most responsible for taking it mainstream.

In Mackey’s view, organic had grown stale. Its guidelines prohibit the use of synthetic fertilizers and pesticides, which is a good thing, he says. But they don’t address all the burgeoning issues—from excessive water usage to the treatment of migrant laborers—facing agriculture today. And once farmers are certified as organic, Mackey believes they have little incentive to improve their practices. “Organic is a great system, but it’s not a complete solution,” he says. “We feel like Whole Foods should take a leadership role in this. Who else is going to do it?”

So in late 2014, Whole Foods WFM rolled out a new rating system called Responsibly Grown, which measures factors like energy conservation, waste reduction, and farmworker welfare.

You could hear the blowback from Monterey County, Calif., to New York’s Hudson Valley. Phone calls and emails flew from one local organic homesteader to another, with many fearing that the new rating system would undermine their brand. When Vernon Peterson of Abundant Harvest Organics in Kingsburg, Calif., brought the issue to the attention of the California Certified Organic Farmers organization, where he’s treasurer, they unanimously decided, “We should fire every bullet we had.” Eventually he and a handful of fellow farmers sent an open letter to Mackey, complaining that the new rating parameters were “onerous, expensive,” and shifted the cost of marketing to growers, “many of whom are family-scale farmers with narrow profit margins.” The New York Times picked up the story, airing it on the front page of the business section. NPR broadcast a lengthy segment on Morning Edition. Says Peterson: “This was a hill to die on.”

In the end Whole Foods made some tweaks to the new program but hasn’t backed down. The 62-year-old Mackey, for his part, seems utterly undaunted by the hullabaloo. Indeed, if there’s one thing to be said about the man, it’s that he has never been afraid of pissing people off. “I am absolutely a contrarian,” he tells me at Whole Foods’ Austin headquarters in one of the first of our many conversations for this story. “You need dissonance, and you need someone who is challenging things. Otherwise you get stuck.”

The same term would certainly apply to Whole Foods itself right now: The company is in a period of dissonance, one that makes the attacks on its Responsibly Grown program seem like small organic purple potatoes. First came accusations, in June, that its stores overcharged customers in New York City—which prompted investor lawsuits as well. Then, in August, comedian John Oliver spent three minutes on HBO’s Last Week Tonight mocking Whole Foods for selling bottled water laced with asparagus stalks … for $5.99. The company said it was a mistake, but the episode gave yet more currency to the notion that the chain dubbed “Whole Paycheck” was out of touch.

The store’s numbers haven’t been pretty either: Same-store sales growth last quarter was at its lowest level since 2009, a fact blamed in part on the New York City investigation and on the longer-term concern that it is facing stiff competition in the healthy-eating ethos up and down the grocery food chain—from Kroger KR and Walmart WMT to Trader Joe’s and Sprouts SFM . All of this Sturm und Drang has been reflected in the company’s stock price. In mid-August shares hit a three-year low, representing about a 50% loss of market cap since October 2013.

“They’re getting Tom Brady-ed,” says BB&T BBT Capital Markets analyst Andrew Wolf. “They’re getting piled on.”

What better time to test what is perhaps Mackey’s most dissonant, brazen idea yet?

He calls it “conscious capitalism,” a mode of doing business that attempts to create value for all stakeholders—employees, customers, community, shareholders—rather than sublimating the needs of the first three to those of the last. The idea is an old one, dating at least as far back as the 1980s, to the work of R. Edward Freeman, now a professor at the University of Virginia’s Darden School of Business, whom many consider the father of “stakeholder theory.” But Mackey, who co-authored a bestselling book on the theme in 2013, has become the closest thing to a modern-day spokesman for an idea that, dare we say, has found its time.

John Mackey photographer in Boulder, CO. August 2015 Mackey leans on his favorite lightweight Gossamer Gear hiking poles on a field in Boulder in August.Photograph by Wesley Mann for Fortune

For evidence, consider the who’s who of America’s business and financial elite who have echoed the theme—often coining first-cousin terms like “compassionate capitalism” (Salesforce’s Marc Benioff), “creative capitalism” (Bill Gates), and “just capital” (investor Paul Tudor Jones) to frame their philosophies. Wrapped up in all these notions is the fundamental precept that profits and purpose should go together—and that companies that marry the two faithfully will outperform the competition over the long term.

That many investors flatly don’t care about the long term is, of course, another matter. Wall Street cares largely about the now and the near future—and right now, and very likely in the near future, Whole Foods is struggling.

Mackey, once again, seems undaunted. “This is where your philosophy gets tested and when you get tested—your own commitment to it, your own integrity. It’s all in question. It’s all in play,” he says. “If you’re going to wreck your company or values just because you’re being attacked, then you’re not very deep.”

Deeply, profoundly, to his core, John Mackey is a capitalist. Though critics over the years have labeled him any number of things—anarchist, socialist, even Marxist—make no mistake, Mackey is a true believer in (mostly unfettered) free enterprise, and his love for it is like that of a convert who finds salvation later in life.

His conversion was not a peaceful one. He had been part of the food co-op movement—and when he abandoned that to start his own for-profit health food store, a group of his friends became ex-friends and gave him the nickname Darth Vader. (He had gone from the light to the dark.) “I got a lot of hate,” he says. “But I didn’t feel like I was evil because I was trying to earn a living and create stores better than the co-op. I didn’t see why I had to apologize for that.”

In many ways Mackey is still the old liberal, granola-chomping hippie he was in his early twenties: He is pro-choice, supports gay marriage, and is for the legalization of marijuana. Yet he also opposes labor unions and once penned a Wall Street Journal op-ed that ran under the headline The Whole Foods Alternative to Obamacare that endeared him to the Tea Party. He is a man who resists media training, although he says he is not as brash and provocative as he once was, that he’s not as ego-driven. “He’s so who he is every minute of every day,” says Whole Foods CFO Glenda Flanagan, who has worked with Mackey for 26 years. “He doesn’t change who he is for anybody or any circumstance.”

“If I had adopted the general philosophy of the left, I would have been loved instead of hated,” Mackey says. “I just couldn’t do it. I’d rather be authentic and have my own intellectual integrity and have a lot of people misunderstand me. If they’re going to attack me I can live with it.”

He is far more sensitive, however, about attacks on Whole Foods. And while I’m in Austin this summer, the company is weathering a blow. The executive team is doing its best to respond to allegations by New York City’s Department of Consumer Affairs that the company systemically overcharged customers for some prepackaged goods. Mackey and his co-CEO, Walter Robb, film a short video in front of the produce section, offering an apology—but insist the errors (having to do with the net weight of the products) were unintentional and were just as often in the customer’s favor.

“This stuff goes viral,” Mackey tells me, “because people are eager to believe bad things about Whole Foods so it doesn’t disrupt their mental model” of business as selfish and greedy. It’s similar to how people scrutinize his diet. “They want to catch me on stuff,” says Mackey, who is a vegan and abstains from processed food. “They want to prove I’m a hypocrite. I think that’s true for Whole Foods as a whole.”

He believes that this prevailing narrative of business—as a selfish and exploitative enterprise—stems in part from intellectuals’ attack on capitalism throughout history, which has fueled the public’s mistrust and skepticism. But another key contributor to this perception, in Mackey’s worldview, is that the dominant business theory of “profit maximization” has been a toxic one. “A metaphor I like to use is that my body can’t live unless it’s making red blood cells,” he explains. “If I stop making red blood cells, I’d be dead in no time. It does not logically follow that the purpose of my life is to make red blood cells.” The same logic applies to business. If a business does not make profits, it dies. But it does not follow that the purpose of business is to make profits.

In the early 2000s, Mackey began giving talks about a new business paradigm and a different kind of leadership, one based on Freeman’s stakeholder theory. Central to the view is that these disparate groups aren’t necessarily at odds. Corporate management teams that are taking action to benefit one stakeholder at the expense of another simply aren’t thinking creatively enough. As Mackey explains, no one has to lose: Business can create an ever-expanding pie, one in which customers and employees and the community at large should benefit as a company grows larger and shareholders are rewarded.

A still more revelatory moment came when Mackey read an advance copy of the book Firms of Endearment, co-authored by Raj Sisodia, explaining how enterprises with passion and purpose outperform. “For a long time I thought Whole Foods was just a weird company and nobody was like us,” he says, “and I read that book, and I realized that we were not alone.” Sisodia visited Mackey in Austin, and the two started using the term “conscious capitalism,” a phrase credited to Nobel Peace Prize winner Muhammad Yunus, author of Banker to the Poor and founder of the Bangladeshi microfinance lender Grameen Bank.

Sisodia and Mackey invited a number of executives to a summit on the notion of purpose-driven business in 2008 and the following year created a nonprofit enterprise called Conscious Capitalism Inc.  But to really spread the movement, Mackey and Sisodia knew they needed a manifesto of sorts: a book targeted at executives. “I felt like businesspeople needed to understand how much value they were creating in the world—that they were good people,” Mackey explains. Says Rick Voirin, the chairman of Stagen, a leadership training firm, and a former board member of Conscious Capitalism: “It pains John that business leaders are thought of so lowly.”

When Conscious Capitalism: Liberating the Heroic Spirit of Business debuted in 2013, it popped onto various business bestseller lists—but the readers who seemed to relate best to the message were fellow chief executives. “I never realized I was a conscious capitalist until John told me that was the title,” says Panera Bread PNRA CEO Ron Shaich. “He’s provided the ideology and language around the approach.”

Two years later Mackey is still proselytizing. In mid-August he travels to the University Club of Chicago to give a talk sponsored by Unilever, a company in the broader shared-value movement. It’s the sixth day I’ve spent with him for this story, but the only time I’ve seen him in anything but shorts. (He is wearing khakis and a Patagonia fleece in lieu of a blazer.) During his presentation, Mackey outlines what’s required to be a conscious leader: analytical, spiritual, emotional, and systems intelligence. Analytical intelligence is what we teach in schools and entails dividing things up to understand them, he explains. Systems intelligence is the opposite—how the puzzle fits together. Later, over lunch (at a local Whole Foods), Mackey says that most people don’t have systems intelligence—which is why many don’t fully grasp stakeholder theory. They don’t get the interdependence, he says. What’s more, they think that if a corporation benefits from an action, the motive must be questionable.

But it’s not as simple as being either self-interested or altruistic, he says. You can be both. Mackey offers the example of the company’s “community giving days,” which are held once per quarter. On those days 5% of a Whole Foods store’s net sales are given to a local nonprofit. It’s the stakeholder model at work, he contends: It creates goodwill with customers, motivates team members, and takes care of communities. “Is it good business for us to do these things?” asks Mackey. “Absolutely.”

Consider the company’s decision to open a store in Detroit, where about 40% live below the poverty line. The project was the brainchild of Robb, who was growing increasingly concerned by Whole Foods’ reputation as a white, elite, expensive company. Whole Foods, he says, “was meant to be healthy food for the world, not just for a few people.” Mackey, however, was skeptical at first: “I’m going to trust you on this, Walter, but I don’t want to lose money,” Robb recalls his partner telling him.

It took less than a year for the store to turn profitable—which led to plans for markets in Newark and Chicago’s South Side (both slated to open as early as next year). But even more important, the Detroit location—with its smaller footprint, fewer products, and lower prices—offered a proof of principle that the company could appeal to a much broader group of shoppers than its current demographic.

The experiment had a surprising dividend: offering key lessons for Whole Foods’ new “365” chain—smaller, lower-priced versions of the flagship brand that will begin rolling out next year. Detroit “gave us some confidence that we could go in this direction,” Robb explains. “365 is an evolutionary strategy,” says Mackey—a way to combat the competition and the next step in broadening access to healthy food, which is the company’s core mission.

Such highfalutin talk may sound to many like marketing blather. But spreading the gospel of healthy eating is something Mackey is truly, unabashedly passionate about. As with capitalism, he was a late convert to the cause. He did not become interested in healthy food until joining the Austin co-op—a start he recognizes as way too late. “If I drop over from a heart attack,” he says, “I’m blaming it on my early childhood poisoning.”

Mackey has spent the lion’s share of his 62 years recovering from that food abuse. When he cooks dinner for me and members of his executive team at his home in Old West Austin in late June, the menu is salad—homemade, oil-less, vegan Caesar dressing on the side—local summer corn, sweet potatoes, and tofu with mushrooms, broccoli, and tahini. Mackey whips up avocado chocolate pudding for dessert with his Vitamix—his secret weapon in the kitchen. When he travels he packs a rice cooker to make oats for breakfast. People scrutinize what Mackey eats, but he is known for being a refrigerator voyeur himself. He offended his wife, Deborah, on their first date by looking in her fridge—he wanted to see her level of “food consciousness.”

For a Fortune 500 CEO, Mackey’s home comes across as modest, decorated with furniture and art from India, where his wife travels frequently. Just off the front entryway is his “man cave,” which sports an exercise bike, an inversion table, and his reading chair.

Mackey, a voracious reader, often has seven or eight books going at a time spanning from science fiction to economic theory. That intellectual thirst started in college, when he took mostly religion and philosophy classes and transferred back and forth between Trinity in San Antonio and the University of Texas at Austin. “I was not interested in ideas until then,” he says.

Some days Mackey would go to the library at 8 a.m. and not emerge until after midnight. “I thought John was probably just the brightest kid at UT,” says Kip Tindell, a college housemate of Mackey’s and CEO of the Container Store TCS , another company that’s part of the conscious capitalism movement. “He’s probably still the most interesting kid in Austin, Texas.”

Mackey loved school but hated assigned texts. One night when he was reading Being and Nothingness by Jean-Paul Sartre, Mackey threw the book on the ground, dropped the course the next day, and decided he’d never read another book he didn’t want to read. He identifies this as the moment when he started to take control of his life. He hitchhiked to New York, grew his hair out, and told his parents he might not get a degree. He dropped in and out of school—never graduating despite having well over 100 credits.

During this period, Mackey was overcome by the enormous diversity of thought in the world—the expanse of different religions and philosophies. He became a born-again Christian because of a girl he fell in love with. He went through an existential, atheistic stage and then became spiritual again—this time in a nonreligious way. He began to meditate. Today he sometimes calls himself a perennialist: a person who believes that beneath all religious traditions there is a universal truth found through spiritual experiences, not through faith or dogma.

He joined a vegetarian housing co-op—the story goes that he did it to meet interesting women. At the time he thought capitalism was the source of society’s problems and that cooperation was better than competition. “It was a very seductive philosophy,” he says. But the deeper he got into the co-op movement, the more he viewed it as dysfunctional—hijacked by the most politically active, who were more interested in boycotts than creating value for members. Mackey was sure he could do it better. He and his then-girlfriend, Renee Lawson, started SaferWay, which evolved into Whole Foods when it merged with the health food store across town.

His father was an accounting professor turned CEO of a small health care company, and he mentored his son in business. Mackey read tome after tome of economic theory—Milton Friedman, Friedrich Hayek, and Ludwig von Mises—with all of his discoveries pointing to a transformative revelation: Capitalism, he now believed, was humanity’s single greatest invention. It made all other progress possible.

On Sept. 11, 2001, Mackey was on his way to the S&P ratings agency near the World Trade Center, close enough to the falling towers that debris rained down upon him. “It reminded me to take care of the things I wanted to do,” he says in reflection. The next year he took a five-month sabbatical to hike the Appalachian Trail. Mackey gave himself the trail name Strider, pulled from one of his all-time favorite novels, The Lord of the Rings. “Strider was the grisly ranger, and nobody knew who he was, but he was secretly a king,” he says. “While I was on the trail and I was Strider, nobody knew I was the king of Whole Foods Market.”

Every couple hundred yards on the Appalachian Trail there’s a two-by-six-inch blaze on a tree that lets hikers know they’re on track. Mackey would joke with his friends that it would be great if life had these little blazes that said you’re on the right path.

In the summer of 2006, Mackey was hiking when he was struck by the notion that he should go to a $1-a-year salary. Whole Foods already had progressive compensation policies. The entire executive team, which makes decisions by consensus, has the same paycheck, and the total cash compensation paid to any employee in a calendar year is restricted to no more than 19 times the average annual wage, including bonuses, of all full-time employees. But Mackey felt as if he had made enough money in his life, and it increasingly bothered him that people would dismiss his arguments about conscious capitalism because of his pay. If he was really going to be a servant leader to Whole Foods, he didn’t want any money conflict. “I wanted to take it off the table,” he says. (The company donates stock options Mackey would have received to one of its foundations.) The only time he’s ever had second thoughts was in 2008, when everything collapsed. The company suspended its dividend, and Mackey had no cash flow. “The best thing about doing something public,” he says, “is you really are the hypocrite if you go back on it.”

Mackey can often seem adamant about his beliefs, but he has a reputation for changing his mind. “John, more than most other high-profile people, is willing to make radical changes and complete changes on things,” says Doug Rauch, the former president of Trader Joe’s and the current CEO of Conscious Capitalism. The most prominent example took place in 2003 at a shareholder meeting in Santa Monica when Mackey got into a heated exchange with an animal-rights activist who said the company wasn’t going far enough. Mackey took the summer to read a dozen books on livestock and animal agriculture and let it marinate while he hiked the Colorado Trail. When he got home, he sent her an email telling her she was right. That led to the company’s animal-welfare rating standards that are in place today.

The episode inspired Mackey to go from vegetarian to ethical vegan. For the first year or two he ate eggs from the chickens at his country place outside Austin. But people were always bringing it up. So again he decided to “take it off the table.” Says Mackey: “I was always having to explain. It was boring for me.”

The animal-welfare standards, along with the company’s sustainable-seafood policy (it sells no fish at low levels of abundance), Responsibly Grown ratings, and decision to become the first national grocery chain to label whether products contain genetically modified organisms, all show a bit of Mackey’s libertarian streak. (He has given $50,000 to a Super PAC backing Rand Paul.) The company has no intention of waiting around until the USDA or some other governing body sets new rules.

His dismissiveness of such rule-making agencies may have been supercharged by past experience. In 2007—the last time, according to Mackey, that Whole Foods was in a cyclical trough—the company was facing off against the Federal Trade Commission, which had challenged Whole Foods’ proposed acquisition of a smaller health food chain, Wild Oats.

During the legal wrangling, the FTC revealed that over a period of years—and under a screen-name alias—Mackey had been promoting his company (and taking the occasional potshot at Wild Oats) in more than 1,000 comments on Yahoo Finance message boards. The SEC, in turn, launched an informal investigation, which left Mackey reeling in anxiety.

That personal emotional bottom, however, led to an awakening of sorts. “I did a lot of spiritual work,” he says, and came to the realization that if he wanted to continue to be the CEO of Whole Foods, there couldn’t be any aspect of his life that was secretive or hidden that would be embarrassing should it become public.

The deal went through, and the SEC dropped the investigation without action. Afterward, Mackey didn’t have any fear in his life, he says. He just let it all go. “Even with this crisis we’re in now,” he says, “I never felt anxious about it or nervous about it. I just don’t feel that anymore.”

But those who know Mackey say that, in fact, he does worry—not so much about doing the right thing but about figuring out what that right thing is. “One of the great things about John Mackey is he’s opinion-rich, but he’s educated,” says Roy Spence, chairman and co-founder of advertising agency GSD&M and a longtime friend of Mackey’s. “He will dog it until he understands what is the right thing to do.”

Mackey is now working on a book called The Whole Foods Diet, based on eating 90% plant-based foods. Sitting on his patio at his summer house in Boulder, he pulls out his iPad to forward me an article on a new study from the Centers for Disease Control and Prevention that found that only about one in 10 Americans eats the recommended minimum five servings a day of fruit and vegetables. “Food culture in America is very toxic,” he explains. “We’re food addicts.” Mackey starts rattling off statistics—54% of our calories come from refined sugars, grains, and oils—basically processed junk food; 32% from animal foods; only 14% are whole plant foods, and a good portion of that comes from fried potatoes. “That’s the obesity problem right there—Americans eat calorie-dense foods.” He adds, “I always say if we were to design a diet to kill people, this is what we would feed them.”

These are not new ideas, but Mackey is creating a model for people to follow. He also has a louder megaphone than most. It’s much like what he did with his first book in conveying what many may have already instinctively known or felt about capitalism. “Once they have a pathway, they can follow it, and everything is a lot faster and easier,” he says. “I like creating those pathways.”

Blending Nonprofit With Profit

Whole Foods has launched three in-house foundations to address challenges facing the local—and global—community.

Whole Cities (Founded in 2014)

MAK.09.01.15_4_ConsciousCap Courtesy of Whole Foods

Helps those in lower-income communities—and in other places where fresh food is limited—get ­access to healthy offerings and nutrition education. It stems from the company’s experience in its Detroit store.

Whole Kids (Founded in 2011)


Funds salad bars (4,091 so far) and gardens (3,014) in schools to combat poor nutrition among children. A salad bar can reduce food waste and eventually ­improve the bottom line for school lunch programs.

Whole Planet (Founded in 2005)


Gives grants to microfinance institutions in places where it does business. It has committed $64.1 million to date in 67 countries. It’s based on the pioneering work of Muhammad Yunus’s Grameen Bank.

To see the full Change the World list, visit fortune.com/change-the-world.

A version of this article appears in the September 1, 2015 issue of Fortune magazine with the headline “The conscious capitalist.”