A "dude" was once a person from the city who went to the country but did not know how to dress. He/She used very inappropriate clothing. It was too fancy, too colorful, impractical, etc. A person from the country considered it an insult to be called a "dude". Even today there are "dude ranches", ranches where people from the city can go to learn to ride horses, relax in the country, etc.
For the past 20 years or so in the USA, "dude" has been used to mean "guy" or "friend". It is used much like "cara" or "tchê".