One source says:
"... The Oxford English Dictionary explains that the name “Pete” in these exclamations is chiefly “a euphemistic replacement for god.”
The phrase “for Pete’s sake” was first recorded in 1903, according to OED citations, followed by “for the love of Pete” in 1906, and “in the name of Pete” in 1942.
The intent, in case you didn’t already know, is to express “exasperation or annoyance,” the dictionary says.
Why “Pete” rather than “Phil” or “Fred” or “Percy”?
We don’t know, though the Morris Dictionary of Word and Phrase Origins speculates (without offering any evidence) that whoever coined “for Pete’s sake” may have had St. Peter in mind.
These “Pete” expressions belong to a large class of euphemistic phrases that developed as substitutes for more irreverent oaths..."