These expressions are used when someone is pleased / not pleased with you.
I think I’m in my boss’ good books. I’ll try not to spoil it.
Sean is in his dad’s bad books because he broke the window on his car.
Tom is in my good books ever since he helped me with that maths problem.
You have to study hard if you don’t want to be in your teacher’s bad books.