Madonna used to "loiter like some weirdo" in front of the building where Wallis Simpson used to live.
The singer is making her directorial debut with 'W.E', about the American mistress of King George VI whom he gave up the throne to marry in 1936, and admits the building where she used live in London fascinated her.
She told Sunday Times Culture magazine: "I filmed right around the corner and I did often go in front of her building and just stand around and loiter, like some weirdo, hoping to pick up something left in the air, some kind of magic left behind.
I tried to imagine the king driving up every day for cocktails. And it turned out my daughter's best friend lives in that building, so I was able to go inside.
"I tried to imagine the king driving up every day for cocktails. And it turned out my daughter's best friend lives in that building, so I was able to go inside."
Madonna – who married British director Guy Ritchie and moved to England in 2000 - also said she felt she could "relate" to Wallis' situation.
She added: "I could relate to her feeling an outsider. I think Id' moved here and got married and had to start my life all over again. I felt like I didn't know anybody, and had no circle of friends, so there must have been an unconscious connection there."
'W.E.' is in cinemas from January 20.