A constructor is a special method in object-oriented programming that is automatically called when an object of a class is created. Its primary purpose is to initialize the object's attributes and allocate resources. Constructors can take parameters to allow for dynamic initialization of the object's properties. Different programming languages have different syntax and rules for defining constructors.