When sleeping with no cover and feel cold at night. I wake up with diarrhea that lasts for 3 or more days. Why would being cold while sleeping do that?

Doctor can evaluate. Odd symptoms require one to find a primary doctor who has plenty of time to hear the whole story. Just being cold from ambient air would not cause diarrhea, but feeling cold may be due to having a fever (which, if due to a stomach bug, could cause diarrhea). A fever on the rise causes one to feel coldness and chills, but a fever that's dropping will cause one to feel hot and sweaty.