Well, you're still very young and getting "Morning Glory" is a good sign that you're healthy and that that side of your brain has been working well during sleep.Dreams etc, sexual drive is very sublime and and think that dreaming has a lot to do with it.
You say you find it painful; go to a doctor and talk man to man about the other problem you mentioned. Spots or rashes at the top of your member. That's probably related to the Morning Glory pain.
Don't forget - your manhood is very important and you only get one of 'em , look after it, don't be embarrassed to talk to a qualified doctor about any problems.