How to keep an object inside a 3D object

I made a 3D box and inside is an object and I tried to make it stay still inside the box. Whenever I move the 3D box, the inside object fly out of the 3D box. How do I make it stay in it place?

I’m guessing your are just using a single Box Collider for your outer box. This will make the physics system think that whatever object is inside of your outer box shouldn’t be there so it will try to spit it out. Instead, try using multiple thin box colliders, one for each wall of your outer cube. Just make an empty child object for each wall, give it a box collider, then size it to fit its associated wall.