Combine 2 objects to 1 object with animations
As Nascent says you can select the object with animation at last, you can also join and the action will still be available in the Dope Sheet &gt; Action Editor and look into the dropdown menu:

But your question is a bit more complex as you want to join a lid to a box object and I guess you want the lid to keep its animation, and you don't want the box to move. In that case you have 2 solutions:

Don't join the 2 objects, just parent the lid to the box (select the lid, shift select the box, then CtrlP to parent). When you'll move the box, the lid will follow, and it is still animated.

Join the 2 objects. In that case you can't count on your current animation anymore as it will move both the lid and the box, but you can use bones to animate the part of the object you want.