Grainger, who recently signed a contract extension with the club alongside assistant manager Steven Rudd, leaves to pursue a career opportunity elsewhere.
Chairman David Bowden said: "It is great sadness for us all that this has happened.
"Danny is an ambitious and talented coach, and we always expected that he would attract attention.
"We never anticipated that this would happen quite so quickly, particularly after signing a longer contract, but our relationship with Danny is strong and we have no wish to stand in his way."
Grainger added: "It is with great regret that I will be leaving my role as first-team manager at Workington AFC.
"I will be forever in debt to the board, players, fans, staff and volunteers for their total support and I would like to place on record my thanks to them all.
"I have received an offer that I did not think would come along and it is an opportunity that myself or family cannot turn down.
"It goes without saying that the last 18 months have been a challenge for the fans and the football club, but I leave knowing myself, my staff and the board have laid the foundations for the long-term stability and success at Workington AFC.
"Finally, Reds will always hold a special place in my and my family's heart for the opportunities they have afforded me, and I really wish all connected with the club the very best moving forward."