Why is the sound from my iPhone not coming from speakers?

My iPhone 4s was working but then the sound does not come from the speakers at the bottom. They come from the speakers beside the camera ( where you put your ears to talk on the phone )

It's tough to answer this without seeing it, but if your phone has ever gotten wet or dirty, I have seen iPhones glitch in a way that the phone thinks there's something plugged into the headphone jack, and therefore will no longer play sound from the speaker.
Try to gently clean the headphone jack out with a cotton swab, or low-psi compressed air (50 psi or less).
If that doesn't fix it, try a hard reset, and then try restoring your iPhone.