Box lid does not open right in animation
The issue is that you want it to rotate on one axis only. However, the local axis for that object is not aligned in that direction, so Blender is trying to rotate it on both the x and y-axes to get it to that new position.

Here's a plane rotating the way you want it to. I've shown the local axis of the object to make it clearer how the plane is only rotating on its local Y-axis.



Now I've applied the transformations of the plane and applied keyframes in the same object positions. You can see how the local axes no longer align with the direction of rotation.



Uh oh! That is not looking good. So how do we fix it?

The first thing you want to do is to clear the object's animation keyframes.

Next, activate the Select tool while in Object mode. You're then going to need to go to the Active Tool and Workspace Settings tab. Under Options > Transform > Affect only, select Origins.



Now, select the box lid and rotate it with R. However, now you will only be rotating the object's origin, not the position of the object itself. Align one of the object's axis so it is normal to the plane of rotation (something that looks like the Y-axis in the first gif, this axis should stay in one place while the object is rotating).

After that, reposition your object and set the keyframes for your animation again.

PS: Nice job with the donut tutorial! I like what you've done with it.