system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: Why do we get that temporary pleasure sensation when we stretch?
gpt
Putting you arms ups and stretching when you wake up is actually just contracting or using your muscles to get your joints to the end of their range of motion.

This exaggerated contracting of the muscles increases blood flow and releases endorphins similar to a mini workout.

If you mean stretching like static stretching when muscles are stretched they tense up and generate a slight pain response to prevent you from injuring them.

The tensing muscles release endorphins again and increase blood flow.

Also, after you stop static stretching the slight pain response is replaced by absence of pain response, which feels good and the muscles that tensed to prevent injury also relax more. Because of homeostasis, the body tends to swing back and forth for a short period of time: Contract muscles then stop, then the body will relax more than before the contraction, for a short time at least. It's like a pendulum overcompensating less and less with each swing.