It's a consequence of the executive's power to... well, execute the law. They can simply decide to not focus prosecution on certain crimes. If they can do that, why not let them also pardon people?

No, it’s based on English clemency. https://govfacts.org/explainer/the-presidential-pardon-power... has a nice explanation of the power and its history.