A compressor is a mechanical device that increases the pressure of a gas by reducing its volume. It works by taking in a gas (like ambient air or refrigerant) and squeezing it, which converts mechanical energy into stored pressure energy for various industrial, medical, and everyday applications.