The map() function is very useful when you want to convert numbers from one range to another range. When do we want to do that? well, we use different ranges of numbers for different things. For example the sin() function returns values between -1 and 1. The valid X positions for drawing on our screen might be between 0 and 400. The right values for RGB colors usually are between 0 and 255.
Sometimes we want to make the color depend on a distance, or maybe the width depend on a speed. You can link any two concepts that come into your mind in your program. Using map() is the easiest way to convert values from one range to another.