This is a term from IT which means to perform some seemingly pointless activity which (1) is required to complete a larger, more important tasks; or (2) is done as a form of procrastination or incidental to the more important tasks.
Often, to complete Task X, a programmer must do Task A, which leads to Task B, then Task C, etc. By the time they finally get to working on Task X, they’ve been “yak shaving” the entire day, just to get to the point where they can do the actual work they needed to do in the first place.
Other times, they find all sorts of things in the process of working on Task X which they decide to complete, either just because “I’m already in there” or as an active form of avoiding working on Task X.
The term originated with Carlin Vieri at MIT in the 90s. He described where he got the term to the Amex developers blog:
I used to play hockey late on Tuesday nights. I would have dinner at midnight Tuesdays and watch TV, and I saw the “Yak Shaving Day” episode [of Ren and Stimpy]. I thought it was so odd, that later when I was struggling to overnight a document (getting permission from an admin, setting up a DHL account, getting a PO, all that nonsense), I told my officemate I was yak shaving.
Over the next few weeks/months, I tried to get folks around the lab to use the term, and Jeremy Brown really liked it. He used it in his GSB post a couple of years after I left the lab.