Getters and Setters protect your object from getting torn apart by whatever code the object get’s put into / accessed from, thus helping the “outside code” to not break itself.
Imagine you’ve got an object with all sorts of data(data you want to be mutable and data that you don’t want to change).
Then, you want to use that object in some code, of course. How do you have that object interact with the rest of your code without breaking the object itself?
Example: the outside code tries to change something in your object, you don’t want it to change because you know changing that part would render your object useless.
Getters, are helpers that let the rest of the code see what’s stored inside the object(“retrieval”), they get the data values from the variables inside and return them to the outside. Setters are similar, they set variables you allow to be changed, if there is no setter inside the object for a value, then the code outside of the object (functions for example) won’t be able to change it. That helps keeping your Object functional.