Your son could have rolled onto or fell onto his abdomen and injured his penis. If he is acting like this is painful, or it doesn't decrease, you should take him to the ER or an acute care clinic. Also, if he wasn't cleaned thouroughly at some point, he could have developed an infection in that area. If that is the case, you may notice a slight or strong odor to the area, there could be pus or discharge, or there could be swelling. If he has a fever, then take him to the ER immediately. This indicates infection.
If nothing above seems to fit his situation, he could merely be experiencing an erection, as all males often do, even infants and toddlers. If he doesn't seem to be in any pain and the swelling and redness subsides shortly, that is more than likely the case. Although somewhat embarrassing, it is nothing to be concerned with.