The main antagonist in the film is a ghost named Ghost of Captain Cutler, who is actually a living person named Morgan, using technology to create the illusion of being a ghost.
It's possible you might be thinking of a different Scooby-Doo movie or episode where a character is possessed. Perhaps you could provide more details about the film or scene you are thinking of?