When the system is switch on, the operating system is automatically loaded into the main memory and it takes control of the computer system. The operating system provides an interface to the user for interaction with the machine by way of managing files, executing a program, or printing an output etc.
The software running on a system can be divided in two categories : application software (CAD, VLC etc.) and System software (OS, compiler, interpreter etc.).
So the OS is a system software. A system software is a layer between the application software the the machine. The purpose of this software is to provide services and resources to the application software on one end, and to harness the power of the machine on the other.
Operating system loads the program (application software) into the main memory and dispatches it to the CPU for execution. OS also provides other resources required by the program e.g. CPU time, memory space, files, input-output devices, messages, interrupts etc.
Precisely, the operating system is a set of programs which acts as an interface between the user and the machine. It manages and allocates the resources available in the computer system. Therefore, an operating system is also called a resource manager.