Sometime in the middle or lower Carboniferous, the amniotes split into two lines. One line lead to the reptiles of all kinds, and we call that the Sauropsida. The other line led eventually to the mammals, and we call that the Synapsida. It is not right to say "mammals evolved from reptiles" because both groups derived from early amniotes. In any event, modern reptiles are vastly different from modern mammals. Both groups have evolved for over 300 million years from the early amniotes.