What is Ghost-type's role, really?
The Legendaries & Their Role:
Giratina is widely regarded as more descriptive of gravity these days, but traditionally it represents antimatter, specifically one of the antimatter theories that suggest that all the antimatter that should exist in the universe but doesn't is located in an alternate dimension. Giratina's design obviously takes on Tsukiyomi, the banished god of moon of Shinto mythology, whereas its domain takes from Yomi, the Japanese underworld.
Same as its Psychic description, but Hoopa's Confined Form showcases that its confined form is just a "ghost of its former self". Its spiritual depiction also matches the pre-Islamic depictions of djinns as spirits.
Lunala is based off moon's reflection of sun. As such, it is light is just a ghost of sun's light. Its bat design takes inspiration from various tribal bat goddesses and night goddesses, while its winged design represents the alchemical eagle that is the opposite of the alchemical lion.
Same as its Fighting description. However, its shadow design takes from shadow boxing, a form of self training which is exactly like how it is written.
The Trainers & Their Role:
Former rival of Professor Oak, Agatha was the first Ghost-type expert... in a generation without Ghost-types. Due to this Agatha had more of a Poison orientation than a Ghost-type one. In FRLG she got a Misdreavus but her team remained more Poison oriented.
Number one Ho-oh fanboy and Eusine's friend, Morty in his initial appearance had a more surfer druggie aesthetic, but in later games gained a more hipster look.
Despite her Hawaiian aesthetic, Phoebe is actually Ryukyuan, and the only actually dark skinned trainer in the original games. Thankfully, this changed in the remakes, which means she is no longer special. Her grandparents are the guardians of the Red and Blue Orbs in Mount Pyre, which she emulates in E4 room.
A French immigrant in English and other Western releases, and an English immigrant in Japanese and French releases, Fantina's design is meant to evoke the generic feeling of a strange and quirky outsider. Despite being a ballroom dancer and a coordinator, her Gym is more designed like a church, alluding to the Arceus church in Hearthome City.
The quirky writer of Pokémon series, Shauntal's design is a pun on term "ghost writer". Despite her room looking like horror novel set, she is actually a conventional novelist who uses references to past events and characters in her works.
Orphaned leftover of the Hawaiian royal family, Acerola is an odd medium with a permanent cat face. Her design is based off the popular Hex Maniac class, whereas her relation to Nanu is said to be not blood related. Her presence is more complex if you think about it.
Most Legendaries of this type represent death, banishment and remnants. Which is fitting for the type, but oddly there aren't anything related to curses and grudges directly, despite type evolving to cover those elements. Most Ghost-type legendaries besides Hoopa do not have much of a humor, going for either a creepy-cool, creepy-beauty and creepy-cute aesthetic.
Some Ghost-types have something to the legendaries of the region and death directly or indirectly, but most Ghost-type trainers have radically different backgrounds and personalities from each other. What they have all in common is an odd calmness, the kind of calmness of a person who has seen it all. Ghost-type trainers also have some sense of humor, though some of them are keen on defeating the player for different reasons(Acerola for taking back the region, Agatha to flip the bird on Oak). Most Ghost-type trainers also feel out of place of their respective region, despite being connected to their mythos.
Ghost-type sadly didn't get much legendaries, instead relying on radically different trainers, predominantly Elite Four members. Ghost-type due to its unique characteristics and historical similarities to Dragon-type have been a popular type for penultimate boss type, but besides Cynthia I don't think it was ever used by a Champion. Which is odd, but then again the entire type is odd.
Ghost-type is sadly lore-wise is more bark than bite. It is far more focused on the aesthetic and theme than actual relevance to the Pokémon world itself. Yet, due to its unique status it always gained something new and always had a haunted place to obtain them... yet Dark and Fighting-types still lack a proper biome.