GPX is the standard export format for GPS tracks and waypoints from fitness watches, hiking apps like AllTrails or Strava, and dedicated GPS units, but showing that track on a web map usually means GeoJSON. This converts GPX track points, routes, and waypoints (including elevation and timestamps where present) into GeoJSON features you can load directly into Leaflet, Mapbox, or MapLibre.
Three kinds of thing in one file
GPX distinguishes tracks, routes and waypoints, and the difference matters. A track is a record of where you actually went, a dense series of points logged by a device as you moved. A route is a plan, a sparse sequence of points describing where you intend to go. A waypoint is a single marked location, standing on its own.
GeoJSON has no equivalent vocabulary, so tracks and routes both become line geometries and waypoints become points. If your file contained both a planned route and the recorded track of the same outing, they arrive as two lines that look alike, and telling them apart afterwards means looking at their names or their point density.
What happens to elevation and time
This is what makes GPX worth converting rather than just viewing. Every point a GPS logger records carries a timestamp and usually an elevation, and often more besides, from heart rate to cadence, depending on the device. That is a time series with a geometry attached, not merely a shape on a map.
GeoJSON can hold elevation directly, as an optional third value in each coordinate. The per-point timestamps and sensor readings have no standard home in the specification and end up in the feature's properties, where the structure depends on the source device. If you are planning to analyse pace or climb rate rather than simply draw the line, check that those per-point arrays came through before you build anything on top of them.