They've been investing in CUDA and machine learning for a long time before the current wave of LLMs. It's absurd to say "right technology, right time" when they were the ones who helped develop it.
Nvidia released CUDA in 2006-2007, which made that discovery possible, but Nvidia wasn't targeting AI with CUDA. It was targeting general high-performance computing (physics simulations, molecular dynamics, medical imaging, etc.).
There's no doubt the company seized on the AI opportunity superbly but the suitability of its product for AI, and the AI boom, was absolutely a "happy accident".