Because oil is a concentrated form of energy, it can be burned to give out light and heat.
In the past, oil was extracted from fruits such as olives by crushing them in presses. The oil was eaten, of course, but it was also poured into the bowls of oil lamps and used to light homes at night.
In fact, oil lamps, using oil from various sources, has been used since earliest times. Oil lamps were in use before candles.
Oil lamps are good because they are easy to make, will last for a long time, and can be refilled so they will burn throughout the night.
Like all oils, olive oil burns at a relatively low temperature and so produces a yellow flame. This flame is made yellow because the gas coming off from the oil carries tiny bits of the wick and burnt oil with it, and these glow in the hot gases as they move upwards. They are the source of the soot as well. As it happens, the yellow flame is kind to the eyes, and so provides a light that is pleasant to see by.
When they burn, all oils smell, so a household with olive oil lamps smelled of burnt olive oil, for example.