Keyhole Markup Language (KML) is an XML ( extensible markup language) notation for expressing geographic annotation and visualization within Internet-based, two-dimensional maps and three-dimensional Earth browsers such as Google Earth.
A shapefile is stored in a set of related files and contains one feature class.
Difference 1- KML is a vector format developed by google and shapefile is developed by Esri.
Difference 2- KML is a highly portable single file that can contain all of a layer or map's elements, such as feature geometry, imagery, symbology, descriptions, attributes, imagery, and other related content. Whereas shapefile contains only one feature class.
Difference 3- Shapefile cannot store 3D data with textures or appearances such as material definitions. It is a multiple Format means users cannot share just one file you must send them all ( .shp .shx .dbf .cpg .prj ) .To be honest, no alternative format has overthrown the Shapefile hegemony yet. Some formats nearly took over shapefile such as KML, GML and GeoJSON , but their usage was limited to relatively narrow use cases only.