We can't say what the physical cause of the darkness was, but we do know what it wasn't.
A solar eclipse can happen only at the time of the new moon.
The Crucifixion was on the 14th day of the month, so a solar eclipse at that time would be impossible.
Lunar eclipses happen at full moons though. and can last for three hours.
Interestingly, a partial lunar eclipse did occur on the 25th of April in 31 CE
(Catalog of Lunar Eclipses: 0001 to 0100).
Even more interestingly, that same day was the 14th day of the Hebrew calendar, the Day of Preparation for Passover
(Passover-dates-26-34-A.pdf).
Unfortunately (for this question), in Jerusalem it was near midnight when that lunar eclipse occurred, so it too doesn't explain the darkness described by Matthew:
Now from the sixth hour [noon] there was darkness over all the land unto the ninth hour [3 pm].
— Matthew 27:45
But that eclipse was a partial eclipse, an event that often causes the Moon to appear red, especially when it can be observed late at night.
There are traditional, non-biblical references to a blood-moon on the night of the Crucifixion.
And while not explicitly about the Crucifixion, Luke refers to Joel 2:31 and the Day of the Lord:
The sun shall be turned into darkness, and the moon into blood, before that great and notable day of the Lord come.
— Acts 2:20