I think <accidental> is about how the note looks while <alter> is about its pitch. As you probably know, depending on the key, e.g. A major, some notes are sharp or flat by default without writing it explicitly.
https://www.w3.org/2021/06/musicxml40/musicxml-reference/elements/alter/