There's probably different ways the LLM converged to it.
One could be for example: from people asking online which tools they should use to build something and being constantly recommended to do it with Next.js
Another could be: how many of the code that was used to train the LLM is done in Next.js
Generally, the answer is probably something along the lines of "next.js is kind of the most popular choice at the time of training".