Running diagnostics is a good suggestion.
OS X Mountain Lion: Use Apple Diagnostics or Apple Hardware Test provides steps on how to run the diagnostics.
Checking in the Console app may help with software related concerns. Click on the All Messages, and then in the bottom right corner, click on the Now button. Doing so right after or during (if possible) when the spinning wheel occurs may help provide a clue if an app is crashing or other similar errors are occurring.
By chance when Sophos is running scans, does the spinning wheel happen? I ask only in the event that Sophos scan is consuming CPU and in turn creating a delay in processing other active apps like Safari.
Running Activity Monitor with the CPU option selected may also help. You can sort the output by %CPU usage, and by default I think the sort is from high to low. If an app or apps are consuming noticeably more than other apps while the spinning wheel occurs, then this could be an indication that one or more apps are consuming resources as noted above. Similarly, you can check out the other system resource tabs in Activity Monitor and see if anything jumps out that can be correlated with the spinning wheel.
Another area to check is if there are any updates available for your system. There could be an update available that may fix or help minimize the issue.
Beyond the above, its hard to provide specific guidance without more details. Hope the suggestions help narrow down what may be causing the problem.