Last year, Elon Musk puffed a marijuana blunt during a live-video interview in California. Halfway around the world, executives at Japan’s Panasonic Corp. PCRFY -0.90% , Tesla Inc. TSLA 2.13% ’s automotive battery supplier, watched with alarm.

“What will our investors think?” one Panasonic executive remembers wondering.

Five years after committing to invest billions of dollars in a shared battery factory in the Nevada desert, Panasonic has a strained relationship with the electric-car pioneer. The Gigafactory was supposed to boost profits, cement Panasonic’s future in automotive electronics and give Tesla easy access to the most important—and expensive—component of its vehicles.

Instead, the partnership has exposed a culture clash between the conservative, century-old Japanese conglomerate accustomed to consensus and the 16-year-old Silicon Valley upstart built around Mr. Musk’s vision for upending 100 years of automotive tradition.

Their shared business is causing headaches. The bosses of both companies are pointing fingers at each other over the handling of battery production. And Mr. Musk’s behavior has rattled Panasonic’s top brass, to the extent that some remain worried about tying their company’s fortunes too closely to Mr. Musk and his Silicon Valley car company.

Tesla’s Gigafactory near Sparks, Nev. Photo: bob strong/Reuters

Mr. Musk has pushed Panasonic to cut what it charges for the battery cells as Tesla builds another costly factory in China. Panasonic Chief Executive Kazuhiro Tsuga has resisted the pricing requests, and says he is hesitant to go into China with Tesla. Production has fallen behind schedule, and the race to catch up has thrown the Panasonic battery unit deeper into the red.

At this year’s annual meeting in June, shareholders criticized Panasonic for getting in over its head. Hurt by the Tesla problems, Panasonic has seen its stock fall nearly 50% since the start of last year.

Tesla, for its part, needs the Gigafactory to continuously improve efficiency and reduce manufacturing costs so it can lower its car prices, which it sees as critical to mainstream success.

Mr. Tsuga, 62 years old, a traditionally reserved Japanese executive, speaks less sanguinely about the partnership than he once had. Asked in September whether he has had regrets about investing in the Gigafactory, he told reporters, “Yes, of course.” At the time he made the decision, he said, “that was the only rational option to supply batteries to Tesla.”

The tension with Tesla thrusts the Panasonic CEO into the uncomfortable position of trying to make the huge investment with Tesla work while he faces a growing faction of executives unhappy with the Gigafactory. Other Panasonic executives say they have no future with Tesla.

Mr. Musk, in an email, said there was no breakdown in the partners’ relationship. He shared a recent message he received from Mr. Tsuga that said “it is not an easy business environment for both of us, but I strongly believe we have to strengthen our partnership even more.”

Separately, both companies issued a joint statement touting their longstanding relationship and commitment to collaborate on “our shared vision for a more sustainable future.”

The relationship began in Tesla’s early days. In 2008, Tesla began delivering its first electric vehicle, the $100,000-plus Roadster two-seat sports car. Mr. Musk, 48, sank much of his money into the company, took over as CEO and set his next audacious goal: an electric luxury sedan to rival BMW and Mercedes-Benz.

Share Your Thoughts Can Tesla make a sustainable, mass-market business out of electric cars? Join the conversation below.

Mr. Musk wanted a partner capable of manufacturing lithium-ion batteries on a mass scale. Each Model S car would require stringing together thousands of finger-size battery cells, the kind commonly used in laptops and other consumer electronics.

The timing was auspicious for Panasonic. It had taken a controlling interest in Tesla battery supplier Sanyo. No longer an iconic consumer-electronics brand in America, Panasonic recorded a $4 billion loss in the year ended March 2009—its first in six years—as bets on mobile-phone handsets and plasma flat-screen TVs were duds. It desperately needed a hit business.

In 2010, Panasonic agreed to make batteries for the Model S. The car received rave reviews, and Panasonic reveled in being at the forefront of electric-car development.

Mr. Tsuga became CEO in 2012, just as the Model S was rolling off the line. He bought into Mr. Musk’s next big bet: the Model 3, Tesla’s first car for the masses.

Mr. Musk wanted to create an unrivaled battery factory to supply the hundreds of thousands of cars Tesla planned to build. In 2014, Tesla announced it would join with suppliers to invest as much as $5 billion to build the Gigafactory, which would be owned and managed by Tesla, and persuaded Panasonic to come on board. Panasonic said it could contribute up to $1.6 billion over time.

Mr. Musk said it eventually would be the biggest building in the world by footprint, spanning more than 100 football fields, although it isn’t that large now.

A Tesla Model S car being fitted with a battery pack at a factory in the Netherlands in 2015. Photo: Jasper Juinen/Bloomberg News

Within Panasonic, the Gigafactory was controversial. Panasonic had sold batteries to auto makers such as Toyota Motor Corp. for decades, but it was used to filling orders at its own factory, with its own managers in charge. Now it would have to make its batteries in a factory controlled by Tesla.

Mr. Musk had been unhappy with the price of batteries Panasonic supplied exclusively for the Model S and had made plans for Tesla to build its own, according to people familiar with the effort. After months of work, however, the costly plan was scrapped, and the two companies worked closely to bring out the Model S, followed by the Model X sport-utility vehicle in 2015.

An early source of tension between Tesla and Panasonic executives, including Mr. Tsuga, was missed deadlines. Panasonic would rush to be ready to supply Tesla’s production targets only to find the auto maker behind schedule, the people familiar with the effort say.

Eventually, Yoshihiko Yamada, Panasonic’s executive vice president at the time, demanded to see inside Tesla’s factory so he could inspect progress on preparing its assembly lines, one of the people says. Mr. Yamada had helped lobby internally for the deal. Mr. Yamada didn’t respond to a request for comment.

From left: Tesla CEO Elon Musk; JB Straubel, then Tesla’s chief technology officer; and Yoshihiko Yamada, then executive adviser at Panasonic, in 2016. Photo: Troy Harvey/Bloomberg News

On the Tesla side, the relationship was held together in part by Kurt Kelty, an American who had spent almost 12 years working at Panasonic, including in Japan, before joining the auto maker during its early days.

Mr. Kelty’s fluency in Japanese and experience at Panasonic helped Tesla navigate the bureaucracy at the supplier, according to people who worked with him. He would sit in meetings between Mr. Musk and Panasonic executives and act as a filter for both sides, softening the tone when the rhetoric got heated, these people say.

Against objections from his deputies, Mr. Tsuga stressed the benefits of working with America’s hottest electric-vehicle startup. An engineer by training, he had developed a liking for fast cars while studying computer science in the 1980s at the University of California, Santa Barbara. People familiar with his thinking say he believed Tesla would inject an entrepreneurial spirit into Panasonic’s consensus-driven culture.

“If Tesla succeeds and the electric vehicle becomes mainstream, the world will be changed and we will have lots of opportunity to grow,” Mr. Tsuga told the Journal in early 2016. By that time, the factory was under construction, and Mr. Tsuga had tethered his fate to Mr. Musk.

Tesla unveiled the Model 3 to overwhelming interest, leading Mr. Musk to try to speed up production plans. At an event to celebrate the grand opening of the Gigafactory in 2016, he promised the plant would be capable of making enough batteries for 500,000 vehicles by 2018—two years ahead of the original plan. That meant the battery factory had to speed up plans, according to people familiar with the effort.

Speed Demon Tesla CEO Elon Musk has put pressure on Panasonic by increasing production forecasts. 2014 2016 Musk persuades Panasonic to invest in the Gigafactory, announcing Tesla will need battery cells for 500,000 vehicles in 2020. Gigafactory begins. Musk speeds up promise of 500,000 vehicles for 2018 and predicts one million for 2020. Vehicles built 1M 800 thousand Vehicles built Musk prediction 600 thousand 600 500 500 400 400 200 200 84 35 0 0 2014 ’16 ’18 ’20 2014 ’16 ’18 ’20 2018 2019 Musk tweets the company will make around 500,000 cars in 2019 at an ‘annualized production rate’ based on the final week of the year. Musk pushes Panasonic to invest more in Gigafactory to increase capacity while also asking for help in building a factory in China. Vehicles built Vehicles built 800 thousand 800 thousand 600 600 400 400 200 200 255 260* 0 0 2014 ’16 ’18 ’20 2014 ’16 ’18 ’19 ’20 2014 2016 Musk persuades Panasonic to invest in the Gigafactory, announcing Tesla will need battery cells for 500,000 vehicles in 2020. Gigafactory begins. Musk speeds up promise of 500,000 vehicles for 2018 and predicts one million for 2020. Vehicles built 1M 800 thousand Musk prediction Vehicles built 600 thousand 600 400 400 500 500 200 200 84 35 0 0 2014 ’16 ’18 ’20 2014 ’16 ’18 ’20 2018 2019 Musk tweets the company will make around 500,000 cars in 2019 at an ‘annualized production rate’ based on the final week of the year. Musk pushes Panasonic to invest more in Gigafactory to increase capacity while also asking for help in building a factory in China. Vehicles built Vehicles built 800 thousand 800 thousand 600 600 400 400 200 200 255 260* 0 0 2014 ’16 ’18 ’20 2014 ’16 ’18 ’19 ’20 2014 2016 Gigafactory begins. Musk speeds up promise of 500,000 vehicles for 2018 and predicts one million for 2020. Musk persuades Panasonic to invest in the Gigafactory, announcing Tesla will need battery cells for 500,000 vehicles in 2020. Vehicles built 1M 800 thousand Vehicles built Musk prediction 600 thousand 600 500 500 400 400 200 200 84 35 0 0 2014 ’16 ’18 ’20 2014 ’16 ’18 ’20 2018 2019 Musk pushes Panasonic to invest more in Gigafactory to increase capacity while also asking for help in building a factory in China. Musk tweets the company will make around 500,000 cars in 2019 at an ‘annualized production rate’ based on the final week of the year. Vehicles built Vehicles built 800 thousand 800 thousand 600 600 400 400 200 200 255 260* 0 0 2014 ’16 ’18 ’20 2014 ’16 ’18 ’19 ’20 2014 Musk persuades Panasonic to invest in the Gigafactory, announcing Tesla will need battery cells for 500,000 vehicles in 2020. Vehicles built Musk prediction 600 thousand 500 400 200 35 0 2014 ’16 ’18 ’20 2016 Gigafactory begins. Musk speeds up promise of 500,000 vehicles for 2018 and predicts one million for 2020. Vehicles built 1M 800 thousand 600 500 400 200 84 0 2014 ’16 ’18 ’20 2018 Musk pushes Panasonic to invest more in Gigafactory to increase capacity while also asking for help in building a factory in China. Vehicles built 800 thousand 600 400 200 255 0 2014 ’16 ’18 ’20 2019 Musk tweets the company will make around 500,000 cars in 2019 at an ‘annualized production rate’ based on the final week of the year. Vehicles built 800 thousand 600 400 200 260* 0 2014 ’16 ’18 ’19 ’20

In a round-the-clock operation, Panasonic workers on one side of the factory assemble millions of cylindrical battery cells, which resemble oversize AA batteries. Autonomous carts then deliver the batteries to the other side of the factory, where Tesla workers and robots stuff thousands into a special battery pack that gets installed in each car.

In the weeks before the Model 3 began production in 2017, Mr. Kelty left Tesla as the companies struggled to meet deadlines. The departure of the key Panasonic ally, along with later exits of other top Tesla executives, hindered the companies’ relationship, people familiar with the matter say. Mr. Kelty declined to comment.

Mr. Yamada, who had spent years coaxing Panasonic into a relationship with Tesla, left the company because he reached the retirement age. He then joined Tesla to help lead the Gigafactory project, assuming Mr. Kelty’s role as a guide. Panasonic’s Mr. Tsuga was now without the deal’s biggest advocate in Japan.

Inside Panasonic, opposition to the alliance heated up. While Mr. Tsuga liked the way Mr. Musk would set a difficult target and meet it—at least sometimes—other Panasonic executives and board members found the entrepreneur’s antics off-putting. That included the September 2018 incident in which he appeared to smoke pot in a video interview with comedian Joe Rogan. In Japan, use of marijuana is a serious crime, and celebrities found with it often are compelled to apologize publicly.

Mr. Musk’s management style also bothered Panasonic. With hundreds of thousands of employees, Panasonic was used to giving its units autonomy to solve problems. Those units might move slowly, seeking Japanese-style consensus, but they didn’t have to kick everything up to the executive suite in Osaka.

Tesla didn’t work that way. Mr. Musk, a self-described “nano-manager,” seemed to have his hands on everything. Employees at the Gigafactory say they found that even small changes to improve efficiency had to get written approval from Tesla managers, who lived in fear of Mr. Musk.

Kazuhiro Tsuga became Panasonic CEO in 2012, just as the Model S was rolling off the line. Photo: Akio Kon/Bloomberg News

Mr. Tsuga, frustrated with the top-down structure, decided he needed to tackle the problems personally, CEO to CEO. This year, he started traveling to the U.S. once a quarter to meet Mr. Musk in Nevada, the Bay Area or Los Angeles.

“If the Gigafactory project doesn’t succeed, we would both fail,” Mr. Tsuga told the Journal in June.

In a news conference in May, Mr. Tsuga said a high-speed line at the Gigafactory still wasn’t operating at full capacity. A person familiar with the facilities says the high-speed “fast lane” to which Mr. Tsuga referred was a request by Tesla—a bid to limit costs by squeezing more production into the same space. Panasonic reluctantly accepted the idea even though it hadn’t built such a line before.

A battery factory must control the moisture in the air to ensure a battery’s safety. Trying to pinpoint the source of the fast-lane production problems, Panasonic sought to fiddle with the ducts that supply dry air to the factory by moving them or adjusting the amount and speed of air blowing into the so-called dry room, says the person familiar with the facilities.

In April, Mr. Musk blasted Panasonic in a tweet, saying the Japanese company was operating at a pace that constrained Model 3 production.

Robots at the Gigafactory help assemble battery cells into battery packs for Tesla's Model 3 sedan. Photo: Benjamin Spillman/The Reno Gazette-Journal/Associated Press

At the May news conference, Mr. Tsuga compared Panasonic and Tesla to a family that quarrels but works out its differences. The reason it was taking so long to increase production, he said, was that the factory was managed and operated by Tesla, leaving Panasonic limited freedom to try out steps to improve efficiency. But he said the two companies had a good relationship.

“Propping up profitability is the No. 1 priority,” Mr. Tsuga told shareholders in June.

Mr. Musk frequently demands Panasonic lower its battery prices, calling Mr. Tsuga’s cellphone directly and emailing and text-messaging him, according to a Panasonic executive with knowledge of the matter.

Mr. Tsuga won’t budge. During his most recent meeting with Mr. Musk, he told him Panasonic wanted to get paid more for its batteries as soon as Tesla is securely profitable, according to a person familiar with the matter.

“Elon makes these repeated price-cut requests, and one time I told him we would consider a complete withdrawal of my people and facilities from the Gigafactory in response,” Mr. Tsuga said in his September comments to reporters. “That’s how a negotiation with Tesla goes.”

Some executives say Mr. Tsuga is becoming a lonely voice when he argues the Tesla relationship is worth saving. Mr. Yamada, who had been so helpful in mediating problems between the two companies, left Tesla in July.

Mr. Tsuga was supposed to meet with Mr. Musk in September. He says he scrapped the trip when the car company canceled at the last moment. In his recent email to Mr. Musk, he signed off with an optimistic tone: “Hope to see you soon.”

Write to Tim Higgins at Tim.Higgins@WSJ.com and Takashi Mochizuki at takashi.mochizuki@wsj.com