Dear Student,
When the light is bright the pupil contracts to allow less light to enter the eyes. But in dim light the pupil expands to allow maximum light to enter the eyes for a proper vision. Thus the size of pupil changes to control the light entering the eye.
The expansion and contraction of pupil is controlled by the iris.
I hope this explains !
Regards!