Does the locking refer to the initiation of the measurement with
starting cue being being the presentation of stimulus or the response
of the subject?
More or less, yes.
When measuring brain activity, you usually make a long, continuous recording during which you expose your study participants to a task over and over again. There's a lot of noise in the recordings, so you need to average over many instances of a stimulus/task event to get an idea of what it does to the brain. To average, you need to cut the recording into trials (also called epochs).
You need to decide what to base these epochs on, i.e. what to cut around. Stimulus-locked measurements happen when you cut an epoch relative to the stimulus onset. The average over all trials will then give you a good impression of the sensory response to the stimulus.
However, there are some higher order cognitive processes going on as well, and they will happen at different speeds over trials and over different subjects, so they will smear out in the average. If you want to look at these, it's wiser to do response-locked measurements, i.e. to cut the epochs around the moment that the study participant responded to the task. This way, just prior to the button press (in the plot), you might get to see some evidence-accumulation or similar cognitive process going on. You can also see the motor response very well.