There isn't a provision in the rules to replace a cantrip once chosen
Also, from the lead dev, there is this statement of intent regarding the Eldritch Knight:
@OtterusMasterus: Eldritch Knights: when gaining a level, can they
exchange a cantrip for a spell for which they have spell slots?
@JeremyECrawford: The intent is that the Eldritch Knight replaces a spell of 1st level or higher with another non-cantrip spell.
The above is consistent with the general absence of any rules text in the PHB addressing the replacing of a cantrip as a character goes up in level. By that absence, by the lack of provision to replace any cantrip in any class upon leveling up, the general case is that once chosen a cantrip is yours forever. The "choosing 1st level spells and higher" feature has a specific way to change one's spell list as one goes up in level. Level 0 (cantrip) spells don't share that feature for any class.
This matches how a cantrip's power goes up with your character level. Let's look at fire bolt:
Make a ranged spell attack against the target. On a hit, the target takes 1d10 fire damage. A flammable object hit by this spell ignites if it isn't being worn or carried. This spell's damage increases by 1d10 when you reach 5th level (2d10), 11th level (3d10), and 17th level (4d10).
The concept is that you stick with a cantrip forever, and that it gets stronger as you (the character) get more powerful as you move into successively more challenging tiers of play. (p. 10, PHB; Adventure Tiers 2, 3, and 4 start at levels 5, 11, and 17).
If a character has levels in more than one class, do the character’s cantrips scale with character level or with the level in a spellcasting class?
Cantrips scale with character level. For example, a barbarian 2 / cleric 3 casts sacred flame as a 5th-level character. (Sage Advice Compendium, 2.0 p. 13)
Crawford also offers this advice in two different tweets. The choice is generally permanent:
Q: Is it possible at all to replace a known Cantrip with a different one? Or is that a permanent choice?
A: Learning a cantrip is typically permanent. A DM could come up with a story-based way to replace one w / another.
The cantrip is a unique kind of spell.
A cantrip is special: it grows in power as you do, and it is magically
bound to you. In most D&D worlds, that bond isn't easy.
In my first campaign, when some new material came out for Temple of Elemental Evil, my DM allowed me to replace one of the cleric cantrips I had chosen, Spare the Dying, with one that was in the EE Supplement: Thunderclap. The decision was thematic due to being a tempest cleric.