Why did Buddha refrain from finding knowledge of the whole universe?
I like to know the reason for this.

Conjecture about [the origin, etc., of] the world is an unconjecturable that is not to be 
conjectured about, that would bring madness &amp; vexation to anyone who conjectured about it.

https://suttacentral.net/an4.77/en/thanissaro
In plain english, the reason for this is that these types of questions are not required for the path towards nirvana at best, or straight up misleading at worst.

Will all this knowledge be worthless if I find nibbana someday?

I wouldn't put down a physicists knowledge of the world, but it has little or nothing to do with buddhas dharma.