Because the companies that get these contracts pay for the politician's war chest.
I don't know if it's ever been conclusively proven, but it's been alleged for decades that the major defense contractors deliberately structure their big projects into subcontracts that can employ people in as many Congressional districts as possible. There are allegedly people in 300+ districts working on the F-35 program, for example.