The feat Magic Initiate lets you learn a 1st level spell:
You learn that spell and can cast it at its lowest level. Once you cast it, you must finish a long rest before you can cast it again using this feat.
Depending on the class you choose, this spell will count as a [class] spell for the purpose of other features.
The Spellcasting class feature is one such feature that mentions [class] spells for classes like Rangers, Bards, and Sorcerers (among others):
Additionally, when you gain a level in this class, you can choose one of the [class] spells you know and replace it with another spell from the [class] spell list, which also must be of a level for which you have spell slots.
Could you replace the spell from Magic Initiate with another spell from that class's class spell list upon gaining a level in that class?
If you replaced the spell with a higher level one "for which you have spell slots", could you then still cast it once using the feat (i.e. without using a spell slot) between long rests?
I'd prefer answers from a RAW perspective, as I'm aware of Jeremy Crawford's tweet indicating a sort of RAI perspective:
Magic Initiate doesn't provide a way to replace its spells