The Internet has its roots on a network developed by the US department of defense.
The first nuclear reactors were a byproduct of the development of the atom bomb.
The first computers were developed during WWII to perform cryptanalysis and solve military problems.
I'm sure opposite examples can be found (mapping the human genome ?) but I doubt they would make a vast majority.