The Cowboy appears twice and both times it is a warning
A corral at night, a man with a hat, and a line about attitude. The scene has almost no plot function and is impossible to forget.

01 A figure who should not be there, but is
He arrives at night, in a corral above the city, and he tells Adam Kesher exactly what to do. The Cowboy is not explained. He does not have a name beyond the obvious one. He speaks quietly, which is more frightening than shouting, and the gist of his message is simple: cast the girl, have a good attitude, and you will see him once more. Make a bad choice and you will see him twice.

The scene's power comes almost entirely from the staging. Director Adam finds a note on his windshield and drives up into the hills above Los Angeles. What he finds there is pure Lynch: wooden fences, a single bright light, a tall man in a hat who speaks like a folk parable and smiles like a threat. The Cowboy carries no weapon. He does not need to. His leverage is invisible — we sense it the way the air pressure drops before a storm — and when Adam asks who he is, the question is simply not answered.

The line about attitude has become the scene's most-quoted element, a loop of pseudo-coaching language that keeps shifting register between self-help and menace. This is Angelo Badalamenti's scoring territory too: the music underneath the exchange holds the scene open rather than explaining it.
The Cowboy's second appearance is brief and almost funny, which is the real unsettling move. Adam is in bed and the Cowboy simply opens the door, is seen for a moment, and leaves. That is all. The condition has been met, the warning fulfilled, the ledger closed. Lynch lets this pass without comment.
What the character actually represents is, correctly, disputed. In a straightforwardly narrative reading he is muscle for the Castigliane brothers, the men who run the thing that runs Hollywood. In the ten clues Lynch printed for the DVD release, the Cowboy is among the items specifically noted, which confirms his significance without fixing it. In readings that take the second half of the film as the real event — the dream preceding it, not following it — he migrates from a symptom of industry corruption into something stranger: an archetype, a dream-figure, a folklore cowboy who appears when the story needs a moral enforcer.
That he works equally well in both registers is the point. Mulholland Drive as a film is built from figures like this — people who feel carved out of something older than cinema, placed into a story about cinema's cruelty, and allowed to stare. The Cowboy stares better than anyone.