The history of photography, at first glance, begins in the 19th century. Still, without some simple machines like camera obscura and pinhole cameras and some basic knowledge about optics, there would be no photography. The history of photography begins somewhere in the 5th century BC.
Photography, as we use it today, is a sophisticated technology. Still, its invention began in the 5th century BC when people noticed that when the light of the solar eclipse passes between the leaves of a tree, it makes an image of an eclipsed sun on the ground. You can find more in the timeline of photography.
Camera obscura is an old device used for optics, astronomy, and art experiments. Its effect became noticeable in the 5th century BC. In time, it became a necessary part of the photographic camera.
At the beginning of photography, images were made on plates (first metal, then glass). In time, the synthetic film became cheaper and easier to use and slowly replaced plates. Here you can read more about the history of photographic film.
Daguerreotype was the first successful and commercial type of photography. Although a relatively complex method, it spread worldwide and remained popular until simpler methods appeared and replaced it.
The first digital cameras appeared in 1970 and were heavy and impractical. They improved in time and are now used by everybody, from amateurs on their mobile phones to professionals who use them. Here you can read more about the history and benefits of digital photography.