Given your lack of experience with electricity and general safety I would discourage you from attempting to modify the grinder in any way.
That does not prevent you from doing this, though. Were I you I would do two things:
- I'd attach the grinder to a wooden base that will be shared with the machine that you'll build.
- I'd make a machine to press the button for a specified amount of time.
For this application you'll need:
- Just about any Arduino board, I'd use an Uno
- A servo, 90 degrees or 180 degrees, wither will do and both are cheap but get one with metal gears as the button may provide resistance. Also be prepared to upgrade it to a stronger one if the button requires a lot of force.
- A real time clock module so you can program different times of day any day of the week easily
You should be able to connect these
- A tiny breadboard and at least 8 single wire jumpers
- (Optional) a case for the Arduino, or a project box, wait to get this until you get things mostly in order. I'd recommend it because this will be in your kitchen, presumably
Here's a tutorial on the servo: Servo: Arduino Basics - Arduino Project Hub
Here a cluster of tutorials on using a RTC: Arduino - RTC
Now you need to learn a bit about both and read on how to make the machine components. Your next post should be to ask a specific question or to show off your awesome electronic button pusher.
Best of Luck!