What is TGA?
Targa dates to 1984 and refuses to die, because game engines and 3D packages standardised on it for textures and never had a reason to move. It keeps an alpha channel, optionally compresses runs of identical pixels, and is simple enough that every tool reads it.
What is PGM?
Greyscale, uncompressed, with a header you can read in a text editor. PGM is part of the netpbm family, and it exists because sometimes you want pixel values you can do arithmetic on without a decoder in the way. Image processing and computer vision code loves it.