Buck Mulligan is a Dublin medical student, and a companion of Stephen Dedalus's. Like Dedalus, he has cast off many of the traditional belief structures and social constraints that might confine a young Irishman's life, but unlike Stephen he is extremely irreverent; he doesn't seem to respect anything.
In this sense, Mulligan functions as something of an alter ego for Stephen. As impossible a character as Dedalus can be to get your head around, it's by noting his contrasts with Mulligan that you begin to understand what Stephen values. Above all, perhaps, is self-respect. On top of Martello Tower, Stephen tells Mulligan that he overheard him call Stephen's mother "beastly dead" (1.87). Mulligan is briefly embarrassed, but quickly begins making excuses and talking himself back into boldness. Stephen carefully explains that it was not so much the offense to his mother that bothered him as the offense to himself.
It's not immediately apparent but as Ulysses goes on, it becomes clear that Mulligan is something of a parasite. He constantly makes jokes at Stephen's expense, but also steals almost all of his ideas from Stephen. After hearing Stephen's Hamlet theory, Mulligan conceives an irreverent play, Everyman His own Wife or A Honeymoon in the Hand, which both plagiarizes and mocks Stephen's ideas. As Bloom puts it, he's "picking your brains" (16.34).
Mulligan is witty, clever, and extremely well-educated, but it's clear that he is jealous of Stephen. Perhaps the only reason his jealousy doesn't overtake him is what he tells Haines in "The Wandering Rocks"' that Stephen will write something of note in "Ten years" (10.594). Mulligan doesn't seem like a character who could imagine devoting himself to anything for ten years, and anyway, that leaves him nine years to mock.
In "Telemachus," as Stephen leaves the beach, he looks back at Mulligan and thinks, "Usurper" (1.356). At the time, it's not entirely clear where Stephen's animosity comes from, but as the novel goes on, it proves to be justified. Between "Oxen of the Sun" and "Circe," we learn that Mulligan and Stephen actually got into a scuffle, and Mulligan stole the key to Martello Tower from him. He thus leaves Stephen drunk and alone in the middle of the night, and turns out to be just what Stephen predicted – a usurper.
That said, Buck Mulligan is an extremely entertaining character. His relationship with Dedalus finds a real life correlation in Joyce's contentious friendship with Oliver St. John Gogarty. But it's clear that Joyce appreciated Gogarty's sense of humor. In Episode 1, we are introduced to his Ballad of the Joking Jesus. Later, in "Oxen of the Sun," we hear about how Buck Mulligan has made business cards and jokingly hopes to open a clinic to help "fertilize" women. Though he only appears briefly in Ulysses, he is one of Joyce's most memorable creations – his own personal Falstaff – and that might be why he gives him the opening line of the novel: "Stately plump Buck Mulligan came from the stairhead, bearing a bowl of lather on which a mirror and a razor lay crossed" (1.1).