The real reason you are sore is that as you exercised, you actually made very small tears in your muscles.
(Don't worry, these tears are extremely small, and are not dangerous. They are just part of how your muscles get stronger!) As your muscles are healing these tears, they swell up and experience inflammation, which is where the pain comes from. If you do this kind of activity often, your muscles will adapt to the effort, and the tears will not occur, so you won’t feel sore.