United appointed a new manager for the first time since 1986 at the end of last season when Moyes was chosen to succeed the retiring Ferguson.
However, Mourinho had long been touted as a contender to take over from Ferguson after enjoying success at Porto, Chelsea, Inter Milan and Real Madrid.
Mourinho claims Ferguson confided in him about his retirement plans and the Portuguese also told the Scot about his planned return to Chelsea after dismissing any dreams of taking charge at Old Trafford.
"I never have these dreams," said Mourinho. "I'm focused on my club, I don't think of any other thing. I was always on the touchline at Old Trafford thinking, 'How can I win this match?'"
Regarding his conversation with Ferguson, he added: "In the same way he told me he was going to retire and I kept secret on that, I also told him I was coming in this direction.
"Not definitely, because I couldn't say that. It was not done and I had a contract with Madrid and I had to be free of that. But at the same time he knew I wanted to come to Chelsea."
Asked why Ferguson confided in him, and vice versa, Mourinho revealed the pair shared many secrets and regularly asked each other's advice on players.
"He thought this big decision he could share with me, the same way I told him that I was on my way to Chelsea," Mourinho added. "We kept that (secret). We trust each other."
Moyes said: "There was a perception at one time that Jose Mourinho would get this job and quite rightly so. He should have been seen as that. He's probably the best of the young, modern managers.
"Quite rightly, he should have been attracting all the top jobs. He's a coach who makes tactical changes, depending on how his team is playing."