What is pain first of all?
When something happens like cutting finger with knife (which is like the stimuli) the nerve endings take up that stimuli and transmit that as an emergency signal to the brain and then the brain indicates that as a pain to us so that we act on the stimuli immediately. (i.e., stop cutting! 😉 )
So, when we keep an ice on the affected area, the ice actually numbs the area – which means it is numbing the nerve endings. So, the nerve cant transmit the signal to the brain and we don’t realize the pain. But without acting on the main reason, if we just keep on numbing the area, then we worsen the problem rather than solving it.
Also, keeping the ice stops blood flow which is the main reason for decreasing the swelling.