Package KML layers
KML layers can be shared independently as layer files (.lyrx) or layer packages (.lpkx). You can also embed a KML layer into a map package (.mpkx) or project package (.ppkx).
Share KML layers
A KML layer cannot be shared as a web layer, but you can share a KML layer in a web map. This simultaneously creates a KML item on ArcGIS Online or ArcGIS Enterprise. You cannot share a KML layer within a web scene. You will receive a warning that the layer's data source is not supported, and the web scene will be created without the KML layer.
Caution:
There is a 10-MB size limit for the web map viewer; anything larger won't open in the map viewer but will open in AllSource.
To learn more about working with KML in ArcGIS Online, see KML.