Let's start with the most basic of questions when it comes to programming a computer: What is a computer? It seems a silly question for a device we take for granted but it's important to understand what it is if you want to program for one.
To put simply, a computer is a calculating machine. That's it. Its sole purpose is to compute things. A computer need not be electronic either, as there were mechanical calculating machines such as Charles Babbage's Analytical Engine, with even programmable machines around as early as the 19th century. Before the advent of fast calculating machines that we're used to, there were actually teams of people called computers to produce math tables. And much like electronic computers of today, human computers were simply given a set of instructions and were not allowed to deviate from them.
While I won't go into a deep dive into the history of machine computers, even with the advent of fully electronic, then fully digital computers (analog computers were a thing!), the computer's job for a while was primarily to handle computation. Everything from military artillery tables, accounting information, to even predicting who would win the 1952 US presidential election. Eventually this evolved into allowing computers to control machines, instead of showing a value to a human and having them control the machine itself. This was mostly useful in aerospace where many minute inputs in a small period time could often correct either an airplane or spacecraft better than a human could based on feel. But as computers became more powerful, eventually it grew to controlling more things, until finally we have our modern, electronic, digital computer.