Why do most military aircraft use different engines than commercial aircraft?
When military and civilian aircraft of similar speeds are compared, their engines differ mostly by their names. It is simply too expensive to develop a civilian type in parallel to a military type when later both are used in the same way. Examples:


The B-52 engine is called J57 and was made by Pratt &amp; Whitney. The same company called this design JT-3C when it was mounted to the Boeing 707 and the DC-8. Later models used a turbofan development of the J57, the Pratt &amp; Whitney TF33, which was called JT3D in civilian use.
The C-5A Galaxy pioneered large bypass ratio turbofans with the General Electric TF39, which was used on the Boeing 747, DC-10 and A300B as the CF6 later.
Even the same aircraft will sometimes use a different name for basically the same engine, depending on the use: The T-39 Sabreliner used the J60 engine while the civilian Sabreliner called the same engine JT12.


But even when the flight regime is different, component reuse is common between civilian and military engines:


The core of the General Electric F101 (installed in the B-1A bomber, the supersonic first version of the B-1) became the CFM-56 turbofan which is used in the Boeing 737 or the Airbus A320.


Supersonic flight requires a high nozzle velocity, therefore high bypass ratios are unsuitable. However, the differences between sub- and supersonic engines disappear the closer you move towards the gas generator core. High-pressure compressor, combustion chamber and high pressure turbine look and work the same. Civilian engines add a large fan in front while supersonic military engines sometimes add an afterburner. The biggest difference, however, is in the intakes (large pitot intake with blunt lips for subsonic aircraft versus adjustable spike or ramp intakes for supersonic flight) and the nozzle (fixed for subsonic flight versus a complex, adjustable convergent-divergent nozzle for supersonic flight).