SharePoint Hosted Apps
When the app is hosted in SharePoint itself, the code is only in HTML and JavaScript and is hosted by SharePoint.
A SharePoint-hosted app may provision basic resources into its app web such as HTML/CSS/JS files, site column/content type/list definitions, etc. Under no circumstances can server-side code run within a SharePoint-hosted app.
Provider Host Apps
In a provider-hosted app, you are responsible for the infrastructure (again, external to SharePoint) where your app runs. You have lots of flexibility in the sense that you can run full-blown server side code and even take advantage of frameworks like ASP.NET MVC (or even use Java, PHP, or other non-Microsoft technologies as well), but you are also responsible for things like tenant isolation.
You or your app purchaser’s IT department must host a provider-hosted app on a dedicated server or third-party hosting service. Depending on your choice, these apps run either on your server or in the cloud. A provider-hosted app can also include SharePoint components that run in SharePoint, so it can be mixed in its hosting
Thanks for learning my blogs!!!