The process which is checking for permission to run apps is called GateKeeper.
As per the following System Preferences screenshot, you are able to configure how it behaves. You can allow it to allow anything to run, only MAS apps to run, or a mixture of MAS apps, and known developers:
The idea for increased security is obviously because security is very very important. It's important for you, to know that you can trust the apps that you use, and it's important for Apple, to know that they can kill apps that they subsequently become aware are malicious or dangerous for users to run.
Once you accept an app to run, it's signature is added to an internal "whitelist" such that you only need to be asked once in order to allow an app to run. If you use the default setting (as per screenshot) you can still run any app by right clicking on it's icon and clicking
open. This will require subsequent confirmation, but again once you have confirmed it once, you are good to go until such time as the apps signature changes (updates etc).