Ibn al-Haytham was born about 965 AD in Basra, near the Persian Gulf (modern Iraq), and when he grew up he went to Cairo, then a rich university center under Fatimid rule, and became a scientist. Al-Haytham first worked on a plan to build a dam across the Nile river, but then he realized it was too hard for medieval engineering skills. He began to do experiments with people's eyes, trying to figure out how vision worked - why could people use their eyes to see things?
Based on his experiments and on Herophilus' description of the structure of eyes (as reported by Galen), al-Haytham supported Aristotle and Ptolemy's view that light came from objects into your eyes (against Euclid's theory that vision rays came out of your eyes and hit objects, the way bats use sonar). Al-Haytham gave many reasons for his conclusions. One reason was that looking at the sun could damage your eyes, so brighter objects must send out stronger rays. Another reason was that you could see the whole sky and stars immediately when you opened your eyes - that would be too many vision rays to send out all at once. Al-Haythem also realized that rays of light came from the sun or candles, always travelled in straight lines, and bounced off the objects to your eyes. Al-Haythem thought (correctly) that color was somehow related to these light rays.
Ibn al-Haytham died in Cairo about 1040 AD, when he was about 75 years old.