Disney bought Marvel Studios and invested in more and more productions because MCU movies were public and critic successful. Not the other way around.
And the hardest way, because they made it with characters no one used to know like Iron-man, Ant-man, Doctor Strange or the Guardians of Galaxy.
Fox had the number 1 comic book franchise, with lot's of well know characters and the best source material available. And they failed.