Well, a lot of questions at same time. Next time, please ask one question at a time.
Well, we have urinary system producing urine and reproductive system producing semen. They are produced and sent through tubes or ducts. Both the ducts join at beginning of penis. So, both can come out through penis.
The openings of urinary bladder is guarded by sphincter muscle, which is involuntary, not in your control. So when you are sexually active, the sphincter closes automatically, and urine won't come out. So both semen and urine wont pass at same time.
Semen is produced and stored in testicles, epididymis. Testicles are located below the opening of penis. So they must be pumped, as they are below penis.
smooth muscles in the walls of male reproductive organs contract in a coordinated wave. The conveyor-belt like movement takes concentrated masses of sperm from the epididymis. But urine is stored in urinary bladder, and bladder is above opening of penis. So if sphincter opens, urine will flow by gravity.
Also, when sexually active, penis gets erection, so the opening is contracted. So only high pressure semen can come out through the small opening when sexually active, as the gravity alone cannot give enough force to urine to come out through the small opening. When penis is not erected, opening is larger, so urine flows .
Last question...
Semen is ejaculated when it is produced in testicles. It is produced , when you are mature. How fast you mature, depends on your diet, and your genetic nature. Average age is 13, but some mature at age of 9 or earlier, others as late as 16.
Time?? Well, if you are mature, ejaculation can happen any time, if you are sexually active for more than a treshold time. It can occur while you sleep, but it doesn't occur generally when you are awake, as brain interrupt sexual signals .
Hope this helps.