Greinke made the announcement himself on Thursday following a meeting with manager Torey Lovullo, according to MLB.com's Steve Gilbert.
MLB made the change official moments later.
Lester is unable to participate in the Midsummer Classic because he'll be pitching for the Cubs on Sunday.
The 34-year-old Greinke is 9-5 with a 3.39 ERA and 1.15 WHIP in 19 starts.
This will be Greinke's fifth All-Star selection.