GPX was made for GPS devices and sports trackers, KML for Google Earth visualization. GPX records routes, KML styles them.
For Garmin, Strava, Komoot, sports tracks, navigation.
For Google Earth, beautiful presentations, styled maps.

GPX (GPS Exchange Format) was released by TopoGrafix in 2002, and the current version, GPX 1.1, dates from 2004. It is an open, lightweight XML schema for moving location data between GPS devices and software.
A GPX file holds three kinds of data: waypoints (single named points), routes (ordered lists of points to follow) and tracks (recorded paths made of segments of track points). Each point has latitude and longitude plus optional elevation, time, name and description; extensions add things such as heart rate.
Garmin BaseCamp and Garmin devices, Wahoo and Hammerhead bike computers, Strava, Komoot, OsmAnd, Locus Map, GPXSee and QGIS read GPX.
It is the common language of navigation devices and sports apps, so a file prepared on a computer reaches a watch or a handlebar unit without conversion. Time stamps make it the natural format for recorded activities.
GPX has no polygons, no styling and only minimal attributes, so an area becomes just its outline. A track is geometry, not turn-by-turn guidance, and files with very many points slow down small devices.
osm2cdr turns points of interest into waypoints that show up as markers on the device screen, and linear features into lines you can walk or ride along. Areas arrive as outlines only, point elevations are not filled in, and turn prompts are left to the navigator's own routing data.

KML (Keyhole Markup Language) was developed by Keyhole, the company behind Google Earth, which Google acquired in 2004. Google later handed it to the Open Geospatial Consortium, and KML 2.2 became an OGC standard in 2008.
A KML document is XML: placemarks with points, lines and polygons are organised in folders, each with a name, a description and optional ExtendedData attributes. Styles define icons, line widths and fill colours; altitude modes and extrusion let features rise above the ground; network links and ground overlays pull in external content.
Google Earth Pro and Google Earth on the web open KML with a double click or a drag; Google My Maps, QGIS, ArcGIS, Global Mapper, Marble and many mobile apps import it.
KML is built for presentation: a client can explore the data on a globe without GIS skills, click a feature to see its attributes and switch folders on and off. As text it is easy to generate, inspect and edit.
It supports only WGS 84, files grow quickly because XML is verbose, and styling is limited to what Google Earth understands. It is a poor fit for analysis: attribute schemas are loose, and large datasets slow the viewer down.
osm2cdr places each layer in its own folder, keeps the OSM tags of every feature in ExtendedData and gives lines and fills a colour and width. Roads, water and greenery lie on the ground, while buildings are extruded to the height from their tags, so Google Earth shows a three-dimensional city straight away.
At the most basic level, GPX is an XML format for GPS waypoints, routes and tracks, while KML is an XML format for showing geographic data on a virtual globe. On disk, GPX is plain XML text; KML is plain XML text.
Here is what the comparison table above means in practice, point by point:

In short: choose GPX when the features have to end up on a GPS navigator, a bike computer or a sports app. Choose KML when the result is shown on a globe to a client, colleagues or students.
You are planning a cycling tour and want the region's paths and points of interest on a Garmin or Wahoo unit. GPX goes straight onto the device or into Komoot and Strava, while KML would need converting first.
You are presenting a planned route and nearby landmarks to a client on a 3D globe. KML in Google Earth shows coloured lines, folders and extruded buildings, none of which GPX can express.
You are logging field visits and want time stamps and elevation stored with every point. GPX records both natively and suits activity analysis, whereas KML is aimed at visual presentation.
Converting KML to GPX drops styles, folders and polygons — areas survive as outlines at best, and extruded buildings become flat shapes. Converting GPX to KML keeps the geometry, but time data and device extensions may be lost depending on the tool. Remember also that osm2cdr's GPX does not fill in point elevations and provides lines to follow rather than turn-by-turn routes; the navigation prompts come from the device's own routing data.
If you need both, export the area twice: the GPX for the device in your pocket and the KML for the meeting room screen. Each export is built from the same OpenStreetMap data, so the paths shown to the client are the paths on the navigator.
On osm2cdr, pick GPX for navigators, bike computers, watches and sports apps. Pick KML for Google Earth presentations, sharing on a globe and visual review with people who do not use GPS devices at all.
osm2cdr builds GPX and KML directly from OpenStreetMap data — there is no need to download raw OSM extracts or install conversion tools. The steps:
Converter pages related to GPX and KML explain each route in more detail:
GPX is an XML format for GPS waypoints, routes and tracks, whereas KML is an XML format for showing geographic data on a virtual globe. In the comparison table, GPX is ahead on GPS devices, time & speed and sports apps; KML is ahead on google Earth and styles & colors.
GPX. It is the common language of navigation devices and sports apps, so a file prepared on a computer reaches a watch or a handlebar unit without conversion.
When google Earth and styles & colors matter most. KML is built for presentation: a client can explore the data on a globe without GIS skills, click a feature to see its attributes and switch folders on and off.
Yes. osm2cdr has a dedicated GPX to KML converter page for existing files. If you are starting from OpenStreetMap, export the area straight to KML instead.
GPX files open in Garmin BaseCamp, Strava, Komoot, OsmAnd, GPXSee and QGIS. KML files open in Google Earth, Google My Maps, QGIS, ArcGIS and Global Mapper.
GPX stores WGS 84 latitude and longitude, with optional elevation and time for every point. KML always uses WGS 84 longitude, latitude and optional altitude, so features land in the right place in Google Earth without any setup.