Allah (SWT) selected prophets to inform people of His teachings. The role of prophets was to show humankind how to act and to spread the word of the one true God, Allah (SWT).
The Qur'an mentions 25 prophets by name, but some believe there have been 124,000 prophets in total throughout history.