This happened to me after an acquisition. I was on my way to becoming a director before our company was acquired and they ended up firing my boss and keeping me in place, with no more room to grow (and stringing me along about starting a new department that I would lead, which was never going to happen).
I used the extra time to start a consulting business and 3X my salary. When I was finally laid off a few years later, I just laughed and continued with my already successful consulting career.
The company was so dysfunctional, nobody really knew what I was doing. When asked, I would just say I was "really busy"/mention some technical stuff I was working on and I would always answer questions immediately from co-workers and management on Teams, to give everyone the idea that I Was still working hard.
What got me in the end was a new VP was hired and looked at the yearly budget. He started questioning why he really needed me and I was gone.
"When my coworker was leaving, I learned that he was earning 2x my salary."
Why would you assume you are worth 2X to the company or any more? Your co-worker might have had more experience than you.
One time, an excel spreadsheet with salaries was leaked at work and I learned I was paid 50% higher than a co-worker in the same position. Multiple things determined this: I had more experience/education and I was better at negotiating my salary when I was hired.
"He told me he'd promote me if I do some project. I went above and beyond,"
I'm not sure how much you were expecting as a raise, but it would have never been even close to 100%. Companies just don't do this.