Directors have, ultimately, artistic control over the final product. While acting can be a satisfying endeavor, the true artistic vision of a story comes from a director. There is also a degree of control over that final vision that no other role has. Many of those involved in acting want to either take a turn at, or, ultimately become directors.
Robert Redford and Clint Eastwood are actors who have achieved as much acclaim for their directing as their acting, and both them are considered huge just for their acting.
Chris Evans, known for "Captain America," doesn't even like the life of an actor/star, as much, and even though he's young and, probably, at his peak of star power and earning potential, he's publicly stated his intention to leave acting (for the most part), preferably to direct, instead.
Variety: Captain America's Chris Evans Ready To Leave Acting Behind
Why do it on TV shows?
- Because many of the shows use a variety of directors for different episodes, so there's more opportunity there for an actor to try it out with small budgets at stake.
- Because of the smaller scale, it's a way for actors to get that initial experience, with the support of proven and experienced professionals they know and trust. There's probably also an established framework or structure the show has for the less experienced director to work within, making the scope of the endeavor less challenging as a starting point (thanks to jpmc26 for pointing this out in comments).
- Many of the actors, their habits, philosophies, etc. are known to the show's producers and studios because they've been working there, so it's an easier sell for the actor to be given that chance.
- Because of their status, many actors have more leverage for that specific show than they would for a completely original project, and because of the lesser impact because of point #1, it's probably a fairly simple way to keep those stars happier.
- As actors stay with a show for longer periods of time, they will invariably get more input to how characters are shaped and story lines are developed. Allowing a hand in directing an episode seems like a natural extension of that growth.