What device tells the computer what to do?

The CPU, or Central Processing Unit. It is what's called the "Brain" of the computer. Of course, higher up there is the mouse and keyboard, which we tell the computer what to do.