Not 100% sure what you want to know, thanks to the edits, (not sure what they desp need) but aside from the NPT business, there is also something to the fact that it is very difficult to pee while hard, and if your bladder is full, you get hard to sort of cork it up until you wake up and can relieve yourself without wetting the bed. I believe there is some truth to the dreaming about sex business because I am almost always ready to go in the morning, where historically this has not been true of most of the women I have been with.
So you can brush your teeth with it when you wake up
Nocturnal penile tumescence (NPT), known these days as "morning wood," is a universal human male trait. In fact, our very, very little bros get 'em in utero. And it's not just morning wood, it's midnight wood and 3 a.m. wood, too.
That provides a clue as to why men have erections when we're sleeping. NPT is very closely linked to rapid eye movement (REM) sleep. The exact mechanism at work has not yet been fully teased out, but during REM sleep activity in part of the brain called the pontine area (among others) increases. It's thought that this triggers a cascade of events including the release of nitric oxide by nerve fibers in the penis. This cascade is mediated by androgen hormones like testosterone.
Though it happens in REM sleep, which is also associated with dreams, we don't necessarily have to be dreaming about all the ways guys who go to Vegas have more fun than we do when we go to Vegas. After all, those in utero boys haven't yet heard of the "gentlemen's club" the Spearmint Rhino. NPT does not depend on erotic visuals.
A 2005 article in the Journal of Sexual Medicine suggests that NPT serves an evolutionary purpose: "It has been speculated that the main function of nocturnal erections is to provide adequate engorgement of the corpora cavernosa, which then leads to increased tissue oxygenation. This is in turn [prevents] cavernous fibrosis, the histopathological basis for corporeal veno-occlusive dysfunction, which probably is the most common cause of organic erectile dysfunction."
In other words, our brains are giving our penises a little nighttime workout, strictly for maintenance, to make sure we stay tuned up. Nothing to worry about.
i remember trying to look it up once.. to make sure my boyfriend wasnt just a horndog or something.. and remember reading something about the chemicals in their body going crazy in the morning.. apparently guys dont really remember their dreams but apparently still dream about sex since they think about it all the damn time, and apparently even though they cant recall it, the images are still sending the signals to the body and whatnot. so when he wakes up hes already hard.. or will be soon lol so i dont know it happens to all guys... its kinda weird though. oh and i dont know why im saying apparently so much, i think its cause i really dont know what im talking about and am just guessing. But i read something like that. You should google it.