One does not simply pull out the power cable to a computer as it can cause errors. If you are reading a disk and the computer is directly turned off, there is a good chance that the disk gets corrupted.
Daemons are programs that run in the background to perform small but important tasks. They run automatically and might periodically access your disk.
Simply powering off the machine might make the disk highly vulnerable to corruption as a daemon might have been reading/writing on it.
The shutdown program exits all processes and kicks all users off the system.
The sync program then ensures that all disks have finished their tasks.
After the execution of these 2 programs the computer is safe to turnoff.
By performing a shutdown from the GUI (or by using shutdown -h now), you are running these 2 programs.
Shown below is a screenshot of my CentOS VM shutting down.