Warren Buffett’s Berkshire Hathaway Inc. is getting out of one of America’s oldest companies: General Electric Co.

The billionaire investor’s firm sold 10.6 million GE shares in the second quarter, a stake that would have been worth an estimated $315 million as of March 31, according to a regulatory filing. Berkshire received most of the shares in 2013 after the investor lent roughly $3 billion to GE in October 2008 during the depths of the financial crisis.

In addition to the shares, Berkshire received hundreds of millions in dividends from GE over several years. All told, Mr. Buffett’s $3 billion crisis-era investment generated a profit of more than $1 billion. Berkshire’s decision to cash out its GE stake came in the same quarter that the conglomerate announced it was changing leaders, with Jeff Immeltstepping aside as chief executive after 16 years and handing over the job to one of his lieutenants, John Flannery.

Mr. Immelt had been under pressure from activist investor Trian Fund Management to cut costs and analysts have expressed concerns the company will need to lower its profit targets.

GE shares have slumped this year, dropping nearly 20%, compared with a 10% gain in the S&P 500 index. It is the worst performing member of the Dow Jones Industrial Average year to date. Last week, Mr. Flannery disclosed he had increased his personal investment by buying $2.7 million worth of GE shares in his 401(k) plan.