Welcome to Android Central! Is it only that you can't hear the person unless you're on speakerphone, or does the other person also have problems hearing you speak?
If you have to turn on speakerphone to hear the other person, then the earpiece speaker is probably faulty. Try booting into Safe Mode -- if the problem persists, then take the phone to a repair shop, or contact HTC if it's still under warranty.