Much of this wording likely derives from plays and performances (also see Actors in computer science):
[0] Program (https://www.merriam-webster.com/dictionary/program): I think the 2nd or 3rd definition is best here (as the later definitions actually refer to computer programs, but don't cut to my proposed etymology) - "2. a: a brief usually printed outline of the order to be followed, of the features to be presented, and the persons participating (as in a public performance)".
[1] Script (https://www.merriam-webster.com/dictionary/script): I think 1c2 again is most relevant here, as it is likely the root of its usage in computers - "1. c (2): the written text of a stage play, screenplay, or broadcast... specifically: the one used in production or performance".