Adapted from my question here. TLDR: not doing dangerous things during the Nine Days is predicated on the existence of demons.
There are various restrictions in place from Rosh Chodesh Av for
Ashkenazim and just during the week of Tisha B'Av for Sefardim. These
are discussed in OC 551.
The relevant portion is the final halacha in the siman, halacha 18:
צריך ליזהר מי״ז תמוז עד ט׳ באב שלא לילך יחידי מד׳ שעות עד ט׳ שעות משום שבהם קטב מרירי שולט ולא יכו התלמידים בימים ההם
<p>One must be careful from 17 Tammuz to 9 Av not to walk alone from the fourth to ninth hours of the day, when Ketev Meriri rules, and one
should not hit his students during these days. </p>
(For the curious, Ketev Meriri is a demon discussed in Pesachim 111b,
Midrash Tehillim 91, Eichah Rabbah 1:29, Bamidbar Rabbah 12:3, Yalkut
Tehillim 842, and Tanchuma Nasso 23. [...])
What's wrong with these activities that they are forbidden during this
time of year? This is sourced in the above Eichah Rabbah and Tanchuma
Nasso, which describe the havoc wreaked by Ketev during this time
period. Accordingly, one should avoid doing things that are dangerous,
lest one tempt Ketev to finish him off. The Midrash cites the example
of a man being chased by another wielding a wooden stick. The latter
was stopped by R' Avahu, who, seeing Ketev chasing him with an iron
stick foresaw that were the man to beat his fellow with the wooden
stick, even though he didn't intend to kill him, Ketev would continue
the beating and kill him. For similar reasons, a teacher may not hit a
student [...], for fear of inciting
the demon on the child.
It's for this reason that one may not do anything dangerous during
these days (R' Moshe in Shmaytsa d'Moshe, p. 428; R' Wozner in Kovetz
MiBeis Levi, Bein HaMetzarim p. 11 sec. 12; et. al.).
(The parameters of this are discussed further and form the basis of my question linked.)