I'm hoping there's a reason, because I keep forgetting which goes which way.
I'm quite curious too, on why "some day" always means future while "the other day" past in English, but that's another matter.
Actually, it's not prohibited to use 近年 for future and 近日 for past in theory, but also customary to mean the other way, as overwhelmingly supported by actual usage. Similar words like 最近 or 近頃 usually stand for recent past, so 近日 is some kind of one odd out among them.
According to Yamagiwa (2014):
The "recent" sense of 最近 came into common use on ca. 1910.
The period when the past sense of 近日 declined and the "recent" sense of 最近 came into use is mostly overlapping.
He thus argues there is a correlation between the meaning shifts of 近日 and 最近; it is either the rise of 最近 made 近日 specific to future, or 近日's loss of past sense was made up by a new definition of 最近.
近日 in few days in past/future and 近年 in few years in past are both in a formal speech. The speaker can be sure about few days in a future. This is why we don't hear 近年 refer to future often.
But if you google "近年中に実現" there're many results, this way we can use 近年 for future references.