My second project there was about enabling the desktop version of Office to be rented and backed by online services. At the time the idea was novel, and nobody believed it'd succeed, _especially_ because Ballmer was pushing it pretty hard. But succeed it did, wildly.
I know multiple such examples anecdotally as well, from friends. The initial versions of Azure seemed like a waste of time also (VMs topped out at like 32GB, everything sucked mightily throughout the entire stack, nobody thought it has a fighting chance). Today it's the second largest cloud, and growing rapidly. Still kinda sucks though. :-)
The initial version of Bing crawler was pretty horrible also (index team had more time, so their code looked squeaky clean in comparison), and it spent years trailing behind Google until they figured out how to close the gap (with "hiybbprqag" thing - the press got it wrong, they weren't "stealing" Google results per se; they augmented training data with clicks that come from Google search pages IIRC). Today Bing powers Duck Duck Go among other things. It's still not a wild success, but it's most definitely not a waste of time either.
Then there are projects where I did something ahead of its time (and was ultimately unsuccessful) yet other people did the exact same thing later and made a ton of money.
Finally I ran engineering at a startup which spent ~3 years largely wasting time and money, only to be acquired for hundreds of millions of dollars for reasons that are still unclear to me.
You never really know. Success is a random, nonlinear process and your effort is but one input to it. I've given up trying to predict if something will be successful if the work that's being done at the front lines is solid from the engineering standpoint. Business is mostly about being very persistent and/or being in the right place at the right time.
For all you know your company might be one PhD hire away from absolutely blowing the doors off competition. Or it may get to that point years later because it started thinking about it now. Or having at least some sort of an AI strategy (even if not very successful) might double the acquisition price in some upcoming merger. All of those things would make your work worthwhile in retrospect even if the project fails. You never know such things.
These uncertain situations are usually a blessing in disguise: because management has no clue, you can pretend that you have clue, and steer things in the direction that's useful to you. Put some cool things on your resume, if nothing else. Move on, see if you have better luck elsewhere.