Around 255 million years ago our Synapsid ancestors ruled the land, but then the mighty dinosaurs came and drove us into rodent-like hiding for 150 million years or so. The dinosaurs (except birds) were done in by natural disaster - most likely by a massive volcanic erruption in India against which that popular asteroid would have been small potatoes (though it may have provided the finishing touches)
Finally freed from dinosaur repression, we synapsid mammals evolved
rapidly in many directions - and will remain in charge at least until the
next disaster (natural or manufactured) - though we still have to be
careful of some close relatives of the birds and dinosaurs, the
aligators and crocodiles.
Fish in shallow waters learned to breath air as a matter of survival, and there are a fair number of air breathing fish living today. A variety of lobe finned fish took a liking to land (plenty of big bugs to eat and no sharks) and evolved into a "Tetrapod Amphibian".
The Tetrapods branched into several lines, and the lineage to which we and
all other mammals belong is the Synapsids. While the famous Permian
Synapsid Dimetrodon used a large fin for temperature regulation, later
Synapsids took cooling and heating internal, becoming "warm blooded" and
developing fur coats. This differs from the dinosaurs who also became warm
blooded but developed feathers instead.
This chart shows descendents of the Tetrapods (for simplicity, extinct (thus inedible) families, minor lines and some intermediate phases have been omitted).