The exhaust fan's operation is a function of the iMac's energy demands: the more power required, the faster the fan runs.
You can use the Activity Monitor app to identify potentially energy-intensive apps or processes: View energy consumption in Activity Monitor on Mac - Apple Support. At your option post a screenshot resembling the following example:
Notice the CPU tab is selected, and %CPU is shown in descending order. The more CPU a process requires, the greater the energy demand, and the faster the fan runs.
I recommend selecting Active Processes from Activity Monitor's View menu, instead of My Processes in the example above which only shows processes for John. That will show everything relevant, including system processes and those of other active users of that Mac.
For reference: About fans and fan noise in your Apple product - Apple Support