Any intense activity that you are not used to can cause delayed onset muscle soreness. It does not hurt right after a workout but hurts usually a day later when you move the affected muscle. The current scientific consensus is that your nerves are actually responsible for this. Intense activity results in microscopic damage to the muscles, which is not intense enough to cause pain right away. The repair process of this damage involves some inflammation and immune cells, so to call them the muscle produces some signal chemicals and molecules that initiate repair. This also makes the neurons that innervate the muscles to become more sensitive to movement.
This does not happen that fast though (it takes time to make new proteins). Thus you are not sore right away because it’s not the neurons sensing damage but them becoming more sensitive to movement. This makes you move your muscles a bit less so that they can heal.