Resting pork tenderloin, and most meats for that matter after cooking, allows time for the moisture inside the meat to get reabsorbed. Cutting it too soon can lead to moisture pooling out onto the plate which can result in a dry texture.
For the absolute best texture and most enjoyable piece of meat, resting should be considered part of the cooking process. However, as long as you cook it to at least 145F, there’s no harm in skipping the rest time and eating it immediately. However, the texture won’t be as good.