Random dummy spinning beachball
The spinning beachball doesn't indicate a truly 'hung' app, it indicates a pending transaction that the app is still waiting for time to process. It ought to only occur when the cursor is hovering directly over the app responsible. If you click anywhere except inside your currently-frontmost app, it will bring another to the front &amp; then you will have to switch back.
Having said all that, my prime suspect on a 4GB RAM Mac would be it is paging to virtual memory &amp; having to wait for the swap to finish. Clicking another app will make it have to swap out &amp; then back again, doubling the time it takes.
This may explain a beach ball that doesn't appear directly related to one given app, but the overall machine is struggling to keep up.
You could test this by keeping Activity Monitor visible on-screen, set to the Memory tab, &amp; see what apps seem to be using the most [browsers get complicated because each tab has its own memory, not just the browser itself] &amp; see what colour the Memory Pressure graph at the bottom of the window shows. Green is fine, orange is starting to become an issue &amp; red will surely start to show problems.
The value for Swap Used may also be indicative of the issue.