Adapt to Environment
When an alteration occurs in the structure of an organism that makes that organism better equipped to survive in the environment that trait is passed down through the process of natural selection.
The following video displays all of the adaptations the platypus has developed over millions of years. The Platypus section of the video starts at 9:50.
I emailed Australian Museum asking when platypuses branched off and developed the ability to lay eggs. A platypus expert responded to my enquiry saying, "The platypus has always been able to lay eggs. Monotremes are the first mammals that branched off from the reptiles. The ability to lay eggs, having an interclavicle (extra bone in the shoulder) and a pair of epicoracoids in the shoulder girdle are remains of reptilian ancestry. You can think of the monotremes, marsupials and the placental mammals as groupings that have branched off independently from the reptiles and have evolved independently from each other. According to fossil evidence, the earliest Ornythorynchid was Steropodon galmani, from the Early Cretaceous (about 130 million years ago)."