Simulating Quantum Light-Matter Interaction for Complex Systems in Optical Cavities