I find that Spanish in this arena is unpredictable with regard to when to be very literal and when to be interpretive. My policy is to be very literal--and be corrected. I then go back and practice prior lessons and sort of remember those nuances, hoping that in the long run, it sticks with me.
To my understanding it is just an irregular noun and is masculine because of it's origin from Latin 'die', which if my memory serves, is masculine and that property maintained.