How do game physics engines work?
By repeatedly asking three questions many times a second: where has everything moved, what is now overlapping, and how should that be resolved — approximating reality closely enough to look right rather than simulating it accurately.
The loop:
Integration. Apply forces — gravity, thrust, drag — to update every object's velocity and position over a small time step.
Collision detection, in two phases. A broad phase quickly eliminates pairs that cannot possibly be touching, using simplified bounding volumes and spatial partitioning, because checking every object against every other is impossibly expensive. A narrow phase then does precise tests on the few surviving candidates.
Collision resolution, calculating impulses that push overlapping bodies apart, apply friction and restitution, and satisfy constraints — joints, hinges, ropes and ragdoll limbs — usually by iterating towards a solution rather than solving exactly.
Why collision shapes are not the visible model. Objects carry simplified collision proxies — boxes, capsules, spheres, convex hulls — because collision maths on detailed meshes is far too slow. This is why you sometimes cannot walk through a gap that looks wide enough, and why a character's silhouette can clip a wall.
Why physics misbehaves. Fixed time steps are essential: if physics ran at the rendering frame rate, behaviour would change with performance — which is exactly the bug behind games where higher frame rates cause faster movement or unintended jumps. Tunnelling happens when a fast object passes entirely through a thin wall between steps, addressed by continuous collision detection at a cost. And solvers iterating a limited number of times leave residual error, which is why stacked objects jitter and ragdolls occasionally launch into orbit.
Determinism is hard because floating-point arithmetic can differ between machines, which matters enormously for lockstep multiplayer and replays.
What is faked. Cloth, hair, water and destruction are usually specialised approximations; most "destructible" geometry is pre-fractured by an artist and simply released on cue.