Scientists now know from studying fossils that they evolved over millions and millions of years to walk on land and breathe air.
Human and land animals evolved from fish. The fish had fins and the fins evolved into feet and legs, and the gills evolved into the lungs, and this allowed them to live on land. So they were called tetropods which means they have four legs.
The earliest type of ocean fish didn’t have jaws and didn’t survive very well, so they adapted to have jaws. The first fish to have jaws was a shark, soon almost all living fish had jaws the ones that didn’t evolve to have jaws became extinct.
Then all the fish swam up to the rivers and became the ancestors of our modern day fish (including the ocean fish).
Some fish continue to evolve like the salmon which changed their spawning time because of global warming.