Imagine that you wrote a letter to your pen pal but that you wrote it in different languages each time.
For example, you might have chosen to write your first letter in Tamil, and the second in German etc.
In order for your friend to translate those letters, your friend would need to:
So then, in order to highlight the language you are writing in, you simple annotate the language (e.g. "French") on the top of your letter.
How would your friend know or be able to read or distinguish between the different language types you are specifying at the top of your letter? That's easy: you agree upon this beforehand.
Because there are different types of data formats which need to be sent over the internet, specifying the data type up front would allow the corresponding client to properly interpret and render the data accordingly to the user.
Why do we have different data formats?
Principally because they serve different purposes and have different abilities.
For example, a PDF format is very different from a picture format - which is also different from a sound format - both serve very different purposes and accordingly are written different prior to being sent over the internet.