FORTUNE -- "Now tell me again -- what exactly is the issue with this company?" Indra Nooyi asks with an edge to her voice.
She has just rattled off a list of statistics describing the financial performance of PepsiCo (pep), the company she has run since late 2006. They show that it has been growing, earning high profit margins, and paying respectable returns to shareholders through dividends and stock buybacks. So, she wonders, what's the problem? Why on earth has she been taking such an infernal amount of heat from investors, Wall Street analysts, and the media? For she has been, and she clearly resents it.
It's a drizzly morning, and Nooyi is aboard a company plane for the 25-minute flight from headquarters in suburban New York City to a Frito-Lay plant in Killingly, Conn. She has been up since 4 a.m., having gone to bed at midnight after watching The Daily Show and The Colbert Report, which she loves. "They say sleep is a gift that God gives you," she observes. "That's one gift I was never given." Definitely not fatigued, she explains how she's been transforming PepsiCo from "a North American fun-for-you company" -- maker of Pepsi, Mountain Dew, Lay's potato chips, Doritos, Cheetos, and hundreds of other foods and drinks -- into a global enterprise with a product line that can prosper in a world where obesity is fast becoming the No. 1 health problem. Making that profound shift, she says repeatedly, is "the right thing" to do. What's more, the company has been "performing while transforming," delivering those financial results she cites. Yet for all that, the conventional wisdom is that she and PepsiCo are in trouble.
This is the hardest time in any transformation, when the returns haven't arrived and no one knows when or if they will. "The recent past reminds me of pivotal moments in our history when bold leaders made decisions that weren't popular but were the right decisions to position the company for the future," says Steve Reinemund, Nooyi's predecessor as CEO, who until now hasn't spoken publicly about the company's prospects. An example was president Donald Kendall's combining Pepsi-Cola with Frito-Lay in 1965. "Few people saw that as smart," Reinemund says. "Major change is never applauded until your numbers prove it. And they will. I'm confident they will."
Are the critics nuts? The most widely repeated case against Nooyi is in fact off-base. It goes like this: The stock has tanked on her watch, shaming PepsiCo in comparison with the eternal enemy, Coca-Cola (ko), which has soared (see "The New Coke"). And she has torpedoed the company's performance by committing far too much time and money to healthy products that make a CEO the darling of the Clinton Global Initiative but that real-world consumers don't want to buy. None of that is true. The stock's total return to shareholders has exactly matched the S&P 500 (SPX) over her tenure. The Coke comparison is invalid; when Nooyi got her job, Coke was just starting to recover from a dismal decade, while PepsiCo stock was richly valued. There's no evidence that a greater focus on good-for-you products -- nearly all of which are in Quaker Foods, Tropicana, and Gatorade, businesses PepsiCo bought long before Nooyi became CEO -- has damaged overall performance. So, as Nooyi defiantly asks, "What's the issue?"
Critics who have looked deeper point out that PepsiCo does face significant challenges that have hurt the company. Its all-important return on capital -- economic profit as a percentage of all the money that investors have put into the company -- has plunged. Several of its most valuable brands, such as Pepsi and Doritos, have lost strength or market share, or both. In an industry that survives by exciting consumers with new products, innovation has been weak; the company has introduced flavor tweaks such as Cherry Vanilla Pepsi, for example, but nothing to match Coke's hugely successful Coke Zero and attention-grabbing bottle and can designs. Basic execution -- getting the right products into the right stores in the right quantities all the time -- has been subpar; the company has had trouble holding its share of retailers' floor space. Overhead has ballooned, leaving the company less efficient and productive than it needs to be.
Combine those sins, and you get a company with a worrisome future. All the facts Nooyi cites about PepsiCo's performance are correct, but they're measures of the past. Investors care only about what's ahead, and they're not confident. Do the math on today's stock price, and it implies that investors don't expect PepsiCo's economic profit to increase for years; on the contrary, they expect it to decline slowly (see chart above) -- not an endorsement of management. "The management team will have a period of time to execute," says Donald Yacktman, whose Yacktman Fund is the largest non-index-fund holder of PepsiCo stock. "If they don't, you have an above-average bench behind them, and there'll be changes."
Nooyi acknowledges that PepsiCo has to change. In a corporate mea culpa before a roomful of Wall Street analysts in February, she and other top executives essentially confessed their sins and outlined a plan to correct them. The company will get leaner by firing 8,700 employees (about 3% of the total), consolidating facilities, and finding other efficiencies, saving about $1.5 billion over the next three years. It will increase advertising and marketing by $500 million to $600 million this year, or about 15%, focusing on a handful of big brands like Pepsi and Doritos in North America. "We don't believe we are delivering enough incremental innovation," Nooyi allowed, and described a plan to introduce more and better new products. The cost of making those changes, combined with expected jumps in the prices of corn, potatoes, aluminum, and fuel will push profits down this year. Then, the company projects, slowly but surely it will finally start raising its return on capital next year. Achieving those goals is no slam-dunk, but the plan is plausible. For PepsiCo's future and Nooyi's legacy, much depends on whether it works. For investors, as CFO Hugh Johnston says, "The question right now is, very simply, 'Show me.'"
The stakes are high. Morgan Stanley analyst Dara Mohsenian describes them starkly in his recent report arguing for buying the stock: Either the plan works, in which case "the stock outperforms," or it doesn't work, which "may lead to more drastic action," such as "management changes" or "strategic action" -- Wall Street code for breaking up the company. Either way, the stock goes up -- a "win-win" for investors, he says. But in the second scenario, PepsiCo as we know it, and presumably Nooyi, may be gone.
How did it all come to this -- thousands of layoffs, falling profits in a growing economy, analysts speculating on breakups? Nooyi, who joined PepsiCo from the Swiss-Swedish conglomerate ABB (abb) in 1994 as chief strategist, got the CEO's job because the board wanted the company transformed. She and the directors saw two massive trends that could enrich or threaten the company: globalization and the worldwide rise of lifestyle diseases -- diabetes, coronary artery disease -- influenced by what people consume. "The board put in Indra as, I think, it believed PepsiCo needs to recast itself over a decade or so, and it saw her as a change agent," says John Sicher, publisher of Beverage Digest. "If it stayed mainly a North American snacks and soft-drink business, its days of strong growth were numbered due to limited North American growth potential."
On globalization she had to move fast and big. PepsiCo's business relied overwhelmingly on developed markets, especially the U.S., which were mature and growing slowly. The rise of the BRICs was not exactly a secret, and PepsiCo trailed far behind major competitors like Nestlé and Coca-Cola, which had been thoroughly global for decades. So she began buying food and beverage companies in emerging economies worldwide -- Brazil, India, Ukraine, and many others -- culminating in two big Russian outfits, the Lebedyansky juice company and Wimm-Bill-Dann, which is mainly a dairy business. That's a lot of buying -- over $7 billion just for the two Russian companies. But "doing it the slow way, organically, would have set us back," says Nooyi. "We had to power forward and then build from there."
Responding to the lifestyle-disease trend was at least as urgent. Obesity was moving beyond its role as the West's worst health problem and becoming a concern in emerging markets. For a company that urges billions of people to consume ever more snack foods and soft drinks, that's a problem.
Nooyi decided that PepsiCo needed a serious R&D operation to get ahead of the looming threat. The company already employed plenty of food scientists who could formulate Spicy Sweet Chili Flavor Doritos, but it wasn't conducting serious research on how to take sugar, salt, and fat out of products. So she hired Mehmood Khan, previously a pharmaceutical research director and chief of the Diabetes, Endocrine, and Nutritional Trials unit of the Mayo Clinic, and asked him to build a big new R&D program. As they both recall, he told her, "It will take five years before we'll see any results. Do you have the patience for that?" She replied, "It's not whether I have the patience. I don't have a choice."
But as the U.S. economy dived into recession and then stayed weak, a new problem emerged. PepsiCo didn't own its U.S. bottlers, having spun them off into a separate, publicly traded company in 1999, as Coca-Cola had done 12 years earlier. The move worked great -- it took tons of capital out of PepsiCo and left the company in the ultra-profitable business of selling concentrate to the bottlers. But in a down economy like 2008-09, the model falls apart as cooperation turns to a no-win war over who will suffer most. And with huge national retailers becoming more important -- Wal-Mart (wmt) alone accounts for 11% of PepsiCo's total business -- the company needed control of its distribution and pricing. So it bought back most of its bottlers (Coke did the same months later) at a cost of $7.8 billion.
Aggressive acquisitions worldwide plus the bottlers deal weren't cheap. Nooyi borrowed big and tripled the capital in PepsiCo from $22 billion to $66 billion. Yet profits barely budged. Result: The company's return on capital plunged from 22% to 11% (vs. mid-to-high teens for competitors). Investors hate when that happens.
Other embarrassments and missteps compounded their worry. "The problem was, as she was thinking about how to move the company into the future, there were some hiccups in North American beverages," says Beverage Digest's Sicher. Those were hiccups that shook the whole body. The business declined through a combination of weak innovation, skimpy advertising -- no Super Bowl Pepsi commercial in 2010 after 23 consecutive years of advertising in the game -- and just plain lame marketing. (Can you think of a Pepsi slogan from the past five years?) While PepsiCo makes most of its money from foods, the performance of its famous drinks in the world's largest market disproportionately influences how the company is perceived by investors, retailers, vendors, and consumers. Pepsi's U.S. market share has dropped from 11% in 2006 to 9.2% last year, says Beverage Digest. A Tropicana package redesign in 2009 so baffled consumers and hammered sales -- it looked like a bargain-priced house brand rather than a premium product -- that it was withdrawn in less than two months. The blunder didn't cost PepsiCo much, but it further shook investor confidence in Nooyi.
For Nooyi and the company, things got really ugly last fall and winter. With the stock price having gone nowhere for two years while the S&P was surging, analysts began talking up the idea of splitting the company into two, snacks and beverages, which Nooyi adamantly opposed. Bernstein Research's Ali Dibadj, top-ranked in Institutional Investor's analyst ratings, calculated it would unlock some $14 billion of value. When he asked 70 major investors an open-ended question about "the biggest source of potential upside" for PepsiCo, their No. 1 answer was a split-up. Around the same time, a series of articles in the New York Post citing "a source close to the board" claimed that "Nooyi is testing the patience of company directors," who were said to be fed up with the flat stock and management missteps. The company didn't comment on the reports. That's also when Relational Investors, an activist shareholder, began buying stock.
Thus the stage was set for Nooyi, Johnston, and the company's top operating executives to meet with analysts and investors in February. Beyond the promised operational improvements, the company pledged to throttle back its capital-spending spree and give managers incentives to raise economic value added (EVA), spurring them to increase returns on capital. The company projects that those crucial returns will rise just half a percentage point a year. After an 11-point drop since 2006, that's not much. But it could be enough. Crunch the numbers, and if returns increase at that pace -- more precisely, if investors believe they'll increase at that pace -- then the stock should start to rise. That would spell vindication for Nooyi.
For her, PepsiCo's performance is now a race against time. The big investments are largely complete -- "The building blocks have all been put in place," she says -- and the question is how well and how soon they'll pay off, plus how much longer she'll remain CEO. She has already held the job slightly longer than her two immediate predecessors, Reinemund and Roger Enrico, and in March the company positioned three executives as succession candidates. They are John Compton, previously head of the food business in the Americas, who was put in the new position of president; Zein Abdalla, European operations chief; and Brian Cornell, who succeeds Compton running the Americas food business and who had left PepsiCo in 2004, rejoining from his most recent position as president of Wal-Mart's Sam's Club. (Most company Kremlinologists seem to favor Compton.)
When PepsiCo has lined up CEO candidates in the past, the transition has usually come within a year. But Nooyi is only 56. She could stay on two or three more years if her transformation shows signs of succeeding. That's the giant "if" hanging over the company now.
There are reasons for hope. The major investments in emerging economies could start to pan out. The new R&D lab is yielding results. Chief scientist Khan, who told Nooyi the effort would take five years to get rolling, notes that "this is year five." A new mid-calorie cola, Pepsi Next, was just introduced and seems to be doing well; the concept has been tried before, but this time the flavor is supposed to be much better. The lab has found a way to make potato chips taste just as salty with less sodium; the result hit the market last year. In a joint venture with Germany's Müller Group, PepsiCo has developed fruit-and-yogurt technology that makes the fruit taste fruitier and lets it sit on top of the yogurt instead of underneath. Most important, the scientists are working on sweeteners. An all-natural zero-calorie sweetener that could be formulated into great-tasting drinks and other products would profoundly change the business. "Based on everything we've seen, we are ahead" of competitors in finding one, says Nooyi.
Until PepsiCo's transformation shows signs of paying off, Nooyi will endure more doubts from Wall Street and the press. She knows it, and it's wearing. "Courage in leadership is very difficult, especially in today's world, where the media doesn't take the time to really understand you," she says. She has finished her visit to the Frito-Lay plant and is back on the plane, returning to headquarters. The edge is gone from her voice. She speaks very quietly: "And so … when people write all the crap that they do, just … get stoic about it."
This story is from the June 11, 2012 issue of Fortune.