Everytime I would rotate in the X-axis the top of the box would rotate 90 degrees but when I rotate in the Y-axis everything sticks together like normal
It sounds like you need to apply the rotation of the top. CTRL+A > Apply Rotation.
Remember that the lid is made from a Cylinder, that was rotated 90° in Object Mode....
So your situation looks something like this:
As you can see, the orientation of the axes of the Origin of the lid is not the same as that of the 'World'.
Also, in the N-Panel the Rotation is not 0° in all fields.