Encapsulation is a fundamental principle of object-oriented programming that combines data and methods within a class while hiding internal implementation details to enhance security and maintainability. It promotes data hiding, information protection, and abstraction, allowing for flexible, reusable code that is easier to test and debug. Accessors (getters) and mutators (setters) are used to control access and modification of private data members, ensuring the integrity of an object's state.