The egg attack took place at the entrance of ABC studios at 9.30 a.m. when Gillard arrived for a radio show, Perth Now reported.
The egg missed her, but hit a female security officer.
"The man was in the cafe adjoining the ABC studio entrance before the egg was thrown," a police spokesman was quoted as saying.
"The egg did not hit the prime minister, but instead struck a dignitary protection officer. The man was quickly arrested by police without incident."
Gillard laughed off the incident, saying: "There was an egg thrown and it did hit a female police officer on the back of her jacket. I have obviously spoken to her and that is the circumstance there..."