The eight-time gold medalist filmed scenes for the HBO drama earlier this month, according to E!.
It is not known when Phelps's episode will air. The new series begins on September 7.
The American sports star recently signed up to host an episode of Saturday Night Live. He will also present a gong at next months MTV Video Music Awards.