A cricket ball is hard and rigid and if it contacts a muscle directly this can be extremely painful. A bruise can result and can get in between the muscle fibres. This is called an intramuscular haematoma.
The area surrounding the haematoma can become hardened and then take quite some time to heal. Physiotherapy is excellent at reducing the size and duration of the haematoma if you seek the advice from the onset.