He is the consummate Walmart company man.

Douglas McMillon got his start more than three decades ago at the retailing giant on the ground floor — in fishing tackle. In February 2014, Mr. McMillon was named the fourth, and the youngest, chief executive in Walmart’s 53-year history.

And in the last week, Mr. McMillon oversaw the biggest one-day plunge in the company’s stock in 17 years after the retailer forecast lackluster sales growth for this year and a steep profit dip for next, in part because of the company’s plan to spend billions of dollars to improve its stores and Internet shopping capabilities. In damage-control mode, Mr. McMillon took to his blog to defend his investments.

“The reaction by the market — while not what we’d hoped — was not entirely surprising,” he wrote. “These investments are critical to our current and future success as a company. Simply put, it’s the right thing to do.”

The problems encountered by Walmart did not appear overnight, nor will a solution. The company that once redefined the retail landscape with its cavernous warehouselike stores that sold thousands of items at a discount — pushing small mom-and-pop stores across the country out of business — now finds itself facing formidable rivals in the digital-shopping arena.