Why were Different Books Revealed?

All divine books delivered the same essence and the same message to humanity. There is no difference between their belief in Allah, belief in the Hereafter and moral principles. Because they all come from the same source. Their names are also common and it is Islam. 
Why were Different Books Revealed? This question can be explained in two ways: 
First, over time, people have differed in understanding the divine books that have been revealed to them, and they have attributed meanings that are incompatible with the divine books. In fact, over time, they changed some divine commands and carried out tahrif over them, and they deviated into beliefs and practices that were incompatible with the essence of the book. (Baqarah, 2/213) Therefore, Almighty Allah (swt) sent a new prophet. 
The second reason is this: There are differences in customs, traditions and social life in the societies to which the prophets were sent. Therefore, although the main subjects of divine religions are the same, there have been differences in some orders, prohibitions, halal and harams.

3