A nocturnal emission is when a man has an orgasm while sleeping. Many young men have their first orgasm this way. They might not understand what has happened to them, if they have not been taught anything about sex.
It is also called a wet dream.
Wet dreams are natural and harmless. They do not mean that anything is wrong with you. The only problem with them is the mess, and it's not a big mess.
Wet dreams sometimes happen during or after a dream about sex, but scientists are not sure what causes them. Most sexual dreams do not cause orgasms.