tl;dr Can a MacBook Pro become unbearably slow because of hardware issues, e.g a hard-drive failure? How can I best diagnose this?
I own a MacBook Pro from 2012, which recently has become unbearably slow: typically any action, such as clicking on a tab or typing, is followed by a spinning beach ball for about 30 seconds, even though I am not running any intensive process (e.g. only the web browser is open, with a couple of tabs; the same thing happens while browsing files in the Finder, or even typing my name at the login screen after rebooting).
What worries me is that I cannot decide whether it's hardware or software related. I upgraded to El Capitan a few weeks ago, and after a couple of days of decent experience (it wasn't very fast, but at least remained usable), I figured after a few patches and/or spotlight doing its background work, things would improve, but no: the computer became so slow that I was forced to format the disk and make a fresh install. Things have not improved one bit, however. One thing I noticed is that the battery is drained very quickly: I had it replaced less than 2 months ago, yet after only a couple of hours sitting idle the machine runs out of battery.
So, I have two options: try the painful process of re-installing an older OS version, and hope this will make it usable again, or give the machine to a repair service to check for hardware problems. This is quite costly here, even if they don't find anything or are unable to fix it, so I'd like to check first wether those symptoms are compatible with e.g. a hard-drive failure (in which case it would be worth getting it changed).
Edit: Following the suggestions offered below, I tried the following:
check the activity monitor: I do not see any process with high CPU load; typically the Finder or Web browser (Safari or Chrome) with a maximum of a few % of CPU usage. During the beach-ball freeze every minute or so, I am unable to focus on the Activity Monitor window to get updates, so it may be that a process appears and disappears during that time.
reset the SMC. For a little while it seemed to be more responsive after reboot. Unfortunately, after 10 minutes or so just browsing the Web, I'm back to the beach ball every couple of clicks.
It seems that regardless of the task -- web browsing, file browsing, text editor, there is a periodically recurring lag that freezes the system for a few tens of seconds every minute or so.