Sperm come out because of sexual orgasm being stimulated by the brain that sends a message to the testicles (in males) to be ready to start releasing sperm during excitation phase. The more the person (male) get excited the more muscles will starts filling up with blood and the muscle around the prostrate will also starts to fill with blood. When the orgasm is reached muscles starts contracting and pushes the sperms out.