Shared hosting is like you are living in a room with a lot of friends. It means you must fit in the same room and you must split the cost of several things because it is affordable and cheap. However, several individuals are sharing the same space, it means everyone needs to live within a space with restricted resources among them. You will have to use the same things (that sounds a little unhygienic).
A VPS runs its own copy of an operating system (OS), and customers may have superuser-level access to that operating system instance, so they can install almost any software that runs on that OS. For many purposes they are functionally equivalent to a dedicated physical server, and being software-defined, are able to be much more easily created and configured. They are priced much lower than an equivalent physical server. However, as they share the underlying physical hardware with other VPSes, performance may be lower, depending on the workload of any other executing virtual machines.