Why do British people lose their accents when they sing?

It's a complex issue, not easily explained in print, rather than with vocal examples, but here's a start. Accents show up largely in (1) the rhythms and tempo of speech; (2) voice quality; (3) the "melody" of speech, the musical pitches, a feature known as "intonation."

First the matter of intonation. If you speak English, then you know that your voice goes up in pitch for a question and down for a statement. Such patterns of intonation occur not only at the end of a sentence but all the way through our speech, and they differ from language to language and dialect to dialect. Because singing forces the melody pattern to comply with the music, the nuances of intonation disappear.

Next, voice quality, a second marker of accent. Singers tend to use a voice that accommodates musical skills rather than the voice qualities characteristic of a language or a dialect. Therefore, the vocal marker of a language or a dialect is masked, or even lost. Finally rhythms. As with voice quality and intonation, the rhythms and tempo are dictated by the music, and in singing, those markers are entirely lost. Note that some cultures have music that matches and reflects their spoken rhythms, their intonation patterns, and their voice qualities. But a Brit singing "Western" music will lose the identifying markers of accent.

Punks don't.