Where does the phrase “run code” or “run software” come from? Why “run”?
Run
As detailed in another question, run is now the word with the most meanings in the Oxford English Dictionary. From the New York Times:
It took Peter Gilliver, the O.E.D. lexicographer working on the letter R, more than nine months harnessed to the duties of what Samuel Johnson once called “a harmless drudge” (plus many more months of preparatory research) to work out what he believes are all the meanings of “run.” And though some of the senses and their derivations try him — Why does a dressmaker run up a frock? Why run through a varlet with a sword? How come you run a fence around a field? Why, indeed, run this essay? — Mr. Gilliver has finally calculated that there are for the verb-form alone of “run” no fewer than 645 meanings. A record.
As run is so versatile, it comes as no surprise that it was applied to computers and computer programs from the earliest days of computers.
An earlier related meaning in the OED is the verb to keep or operate machinery, for example from 1840:
The farmers would find it difficult to run a mill to make cloths, or to build and sail a ship to take his produce to market.
And the noun, the act of making machinery run from 1864:
The Blue Gravel claim (placer) at Smartsville, cleared up, after a run of two weeks of their mill, the sum of $44000.
The first electronic digital computers were developed between 1940 and 1945 and it's not surprising the earliest relevant OED entry for the noun run is from 1941.
IV. Senses relating to the operation or management of something.
IV 50 d. Computing. An instance of the execution of a program or other task by a computer.
1941 Jrnl. Amer. Statist. Assoc. 36 513 While a maximum of 54 runs through the tabulator is required, only one-ninth of the cards are used during each run.
The verb follows from this:
V. To (cause to) operate or function.
79. d. (a) trans. Computing. To perform (a computation) on a computer; to cause the instruction in (a program) to be carried out, to execute. Cf. run n.2 50d.
1946 Man. Operation Automatic Sequence Controlled Calculator (Harvard Computation Lab.) vi. 289 A clear copy of the coding must be provided before an attempt is made to run a sequence tape on the calculator.
Code
Modern computer programs are software written with a programming language, and software can be run on a computer. A program is a special code that a computer process and can understand, and software is also known as a code. (Writing a program is also known as coding.) Early programs were "written" by punching holes in tape in a special sequence, or code, that the computer could process and execute, or run.
This meaning of code also comes from the early days of computing. The OED:
3. c. Cybernetics. Any system of symbols and rules for expressing information or instructions in a form usable by a computer or other machine for processing or transmitting information.
1946 Nature 26 Oct. 568/1 The brains of the machine lie in the control tape, which is code-punched in three sections.