There is a good analysis of this, with regards to negative states of mind, in the Uddesa-vibhanga Sutta (MN 138).
Concerning the external scattering and diffusion of consciousness:
"How is consciousness said to be scattered & diffused? There is the
case where a form is seen with the eye, and consciousness follows the
drift of (lit.: 'flows after') the theme of the form, is tied to the
attraction of the theme of the form, is chained to the attraction of
the theme of the form, is fettered & joined to the attraction of the
theme of the form: Consciousness is said to be externally scattered &
And the same applies to the other senses.
This describes how external sensual inputs can trigger a chain reaction resulting in the consciousness becoming consumed and following the drift of the theme. But why does this happen?
"And how is agitation caused by clinging/sustenance? There is the case
where an uninstructed, run-of-the-mill person — who has no regard for
noble ones, is not well-versed or disciplined in their Dhamma; who has
no regard for men of integrity, is not well-versed or disciplined in
their Dhamma — assumes form to be the self, or the self as possessing
form, or form as in the self, or the self as in form. His form changes
& is unstable. Because of the change & instability of form, his
consciousness alters in accordance with the change in form. With the
agitations born from the alteration in accordance with the change in
form and coming from the co-arising of (unskillful mental) qualities,
his mind stays consumed. And because of the consumption of awareness,
he feels fearful, threatened, & solicitous.
And the same applies to the other aggregates.
For example, deep within you, you take the form to be your self. If you get a minor injury like a splinter in your foot, this would trigger despair and agony in you, because you take your foot (which is essentially part of the form) to be your self.
Another example is, you may take the mental fabrication of your ethnicity, to be your self. You may strongly associate yourself with your ethnicity. So, when someone insults you with a racial slur, it goes in through your ears, and triggers anger and rage in you, because you take your ethnicity (which is essentially a mental fabrication, specifically a mental concept) to be your self.
So that makes complete sense. Agitation is caused by clinging/ sustenance.
Now if you become angry as in the second case, as I'm sure you have previously experienced multiple times in your life, did you assault or kill someone? I guess not. Somewhere along the way, you came to your senses and gained control of yourself. You just need to ponder this chain reaction and how you gained control of yourself.
The method to control yourself here, is by practising heedfulness (or appamada), to watch your mind carefully. Please see this answer for details.
I'm trying to convince you here that you have managed to control your anger before in your life, so you surely can do it again. And the same applies to other negative states of mind.
There are details regarding the use of heedfulness (appamada) in the Vina Sutta (SN 35.205) as follows:
"Monks, in whatever monk or nun there arises desire, passion,
aversion, delusion, or mental resistance with regard to forms
cognizable via the eye, he/she should hold the mind in check.
[Thinking,] 'It's dangerous & dubious, that path, thorny & overgrown,
a miserable path, a devious path, impenetrable. It's a path followed
by people of no integrity, not a path followed by people of integrity.
It's not worthy of you,' he/she should hold the mind in check with
regard to forms cognizable via the eye.
(and the same applies to the other senses)
"Suppose that corn had ripened and the watchman was heedless. A
corn-eating ox, invading the corn to eat it, would intoxicate itself
as much as it liked. In the same way, an uninstructed run-of-the-mill
person, not exercising restraint with regard to the six media of
sensual contact, intoxicates himself with the five strings of
sensuality as much as he likes.
"Now suppose that corn had ripened and the watchman was heedful. The
corn-eating ox would invade the corn to eat it, but then the watchman
would grab it firmly by the muzzle. Having grabbed it firmly by the
muzzle, he would pin it down by the forehead. Having pinned it down by
the forehead, he would give it a sound thrashing with a stick. Having
given it a sound thrashing with a stick, he would let it go.
"A second time... A third time, the corn-eating ox would invade the
corn to eat it, but then the watchman would grab it firmly by the
muzzle. Having grabbed it firmly by the muzzle, he would pin it down
by the forehead. Having pinned it down by the forehead, he would give
it a sound thrashing with a stick. Having given it a sound thrashing
with a stick, he would let it go.
"As a result, the corn-eating ox — regardless of whether it went to
the village or to the wilds, was standing still or lying down —
wouldn't invade the corn again, because it would recall the earlier
taste it got of the stick.
"In the same way, when a monk's mind is held back, thoroughly held
back, from the six media of sensory contact, his mind settles
inwardly, grows steady, unified, & concentrated.
Disconnecting the chain reaction above by watching your thoughts heedfully is one solution, but the other, is to gain compassion out of empathetic understanding or empathetic insight. Why did someone insult you? It's because he did not have control of his mind, because he is deluded. This way, you can grow compassion towards other people and tolerate their shortcomings. However, this method is only applicable when there are other people or other sentient beings involved. You cannot grow compassion towards a splinter.