Welcome to the Apple Support Communities. I understand you're curious about a feature on your iPhone, so I wanted to take a moment to clear things up. There's a proximity sensor built into the iPhone that recognizes when it's being held up to your ear for phone calls, and when it detects this, it naturally makes the screen go black to prevent accidental touch recognition. This is an intentional feature, and isn't one you can disable by modifying your settings.
I hope this clears things up for you, but let me know if there's anything that doesn't make sense.