Continuing Jigar's answer: There are a couple of things that come under encapsulation.
Contract Management: If you make it public, you are literally making anyone to change it to whatever they want. You can't protect it by adding a constraint. Your setter can make sure data gets modified in an appropriate way.
Mutability: You do not always have to have a setter. If there is a property that you wanted to keep immutable for the life span of the object. You just make it private and have no setter for it. It will probably be set via constructor. Then your getter will just return the attribute (if it's immutable) or a copy of the attribute (if attribute is mutable).