If you examine the Console logs you may see that your iMac wakes up from time to time, but I believe that only happens if you set "Wake for network access" in System Preferences > Energy Saver. It may perform any required maintenance tasks at those times.
The Mac performs daily, weekly, and monthly routine housekeeping tasks, among which is to archive old logs and cache files. Any overdue tasks are accomplished when the system wakes from sleep or starts from a cold boot.
A long time ago - several versions of OS X, way back to Tiger at least - these tasks were scheduled to occur at fixed times during the night. If your Mac was asleep or off during those times, the tasks would not be completed and the log files would grow large. This gave rise to a number of "cleanup" utilities that were intended to substitute for tasks the Mac did not do when it was supposed to them. Such utilities have been unnecessary for years, yet the myth of having to maintain your Mac persists to this day.
The Console app is in your Utilities folder, and is the place to examine the extensive logs on everything the Mac does.
If you are not opposed to the idea, you can permit Apple to collect these logs for diagnostic purposes:
These log files do not occupy much space but the system deletes them when they're a few weeks old - it is also aware of impending disk space constraints and will accelerate deletion if necessary.