Why 天 is chosen for counting days instead of 日 in Mandarin?
Interesting question. Is there a preference when it comes to using 天 for 日?

In my opinion, there are no such a strict rules when it comes 天vs日.(I was born and raised in southern China, lived in the North for several years. I speak Cantonese, Mandarin, Hakka)

Basically, 周天and周日, 星期日and星期天,明日and明天, 改日and改天 are all equivalent. But why people prefer one to another?

There're some reasons: 


In some south-western dialects, 日and一 have similar pronunciation. So people prefer use 周天than周日。
Speaking in rhyme. 天tian1, 日ri4. So in some cases, it sounds weird to use天, but in another case, it sounds weird to use 日。That's depends.