When I buy a stock, I generally approach it as if it were going to be in my portfolio forever. That is, I buy stocks because I see long-tailed growth catalysts and because I hope to compound my returns over a period of decades as my thesis plays out.

Unfortunately, it doesn't always work out. While I have several stocks that have been a part of my portfolio since I first started investing, the reality is that I do sell stocks from time to time when the original reasons for buying them no longer apply.

One stock in my portfolio that falls into this category is investment banking giant Goldman Sachs (GS 1.79%). Here's why I bought shares of Goldman in the first place, what went wrong, and why I've decided to sell my shares and move on.

Why I bought shares of Goldman Sachs

I started building a position in Goldman shortly after the initial COVID-19 plunge in the market and added to my position in 2021. And while I'm a fan of Goldman's core business -- there's no stronger name in investment banking -- I bought the stock for a very specific reason.

At the time, Goldman's CEO, David Solomon, was all-in on consumer banking. The Marcus savings and loan platform was successful, and just a few months before I bought shares, Goldman and Apple teamed up to offer the Apple Card, which had a highly successful launch. Plus, Solomon had mentioned several other areas of consumer banking he wanted Goldman to pursue, such as mortgages, checking accounts, and insurance products. Goldman also partnered with Apple on a high-yield savings product that attracted billions in consumer deposits.

In 2021, consumer banking made up about 2% of Goldman's total revenue. But management's vision was to essentially create the next big consumer bank. And it certainly made sense. After all, there was no other company that had a top-notch financial brand name and no legacy branch infrastructure weighing on its cost structure. Goldman appeared to have a big competitive advantage. If Goldman could replicate its investment banking and wealth management success in the consumer banking world, it could have been a massive home run for investors.

Goldman's consumer banking exit

Goldman's consumer banking ambitions started to produce red flags shortly after that point. Despite rapid growth in both lending and deposits, Marcus was still losing money in mid-2022. And lots of it. Plus, the highly anticipated Marcus Invest robo-advisory product wasn't successful. Losses from the consumer banking business are said to be in the billions.

Next, Goldman exited the consumer loan business, which was its initial consumer banking endeavor. Marcus still offers a high-yield savings platform but is no longer making loans.

The credit card business was another story. In mid-2022, Goldman's credit card practices were under investigation by the CFPB. Now, Apple and Goldman Sachs are set to dissolve their credit card partnership altogether even though there are five years remaining on the contract between the two.

In a nutshell, Goldman is in the place of winding down its consumer banking ambitions, and quite frankly, the execution (especially when it comes to credit cards) hasn't been impressive.

The key takeaway

One of the most important -- yet misunderstood -- concepts about investing is when it's a good idea to sell a stock. Many believe that if a stock goes sharply lower, it's a good time to get out and move on, and conversely, many investors believe that you should take profits if a stock goes up by a certain amount. But it's almost never a smart idea to sell based on a price movement alone.

The No. 1 reason to sell a stock, aside from needing the money, is because your original reasons for buying the stock no longer apply. And that's the case here. I'm not selling Goldman because it went up or down, although I'm making a decent profit on the sale. I'm selling it because I bought shares with a specific long-term thesis in mind, and that thesis has been busted. Aside from its consumer banking potential, Goldman wasn't my favorite bank stock, and it still isn't, so I've decided to sell and redeploy the money where I see better opportunities, of which there are several in the banking industry.