The woman in 237 is one of the many elements of The Shining (1980) that are intentionally left ambiguous by Stanley Kubrick, but were explained in greater detail in the novelization.
The woman’s name is Mrs. Massey, and she was an older woman who came to The Overlook to have an affair with a younger fellow. One night, the younger man stole her Porsche and left. She was heartbroken and killed herself in the bathtub with sleeping pills and liquor.
As such, when Danny (Danny Lloyd) enters her room in the film version, he’s able to see her. When Jack (Jack Nicholson) enters the room, he sees a younger, beautiful woman instead of the deceased old woman. It’s not until he kisses her that she becomes the corpse. A popular theory is that she represents the overall seductive power of evil that inhabits the hotel, and is taking over Jack. Kissing her is his submission to the evil forces at work, and the turning point where he loses any goodness left in him.
“This is the strangest scene in the film. It has no reference to earlier events, and it seems completely unconnected with any of the characters. Yet it serves as an important link between all the characters in this psychic drama. It would be wrong to insist on a single interpretation of this scene, but in looking at it it exposes the heart of Kubrick's method in the film.” - Paul Mayersberg
Mayersberg goes on to note the ways in which the scene is a rewrite of Psycho’s bathtub scene, is a reversal of horror conventions, is overtly sexual in nature, and is ambiguous in nature.
“All these interpretations have a certain validity without getting near totally to describing the scene. It may come down to the simple fact that the scene in room 237 is no more nor less than a nightmare of its creator. But one of the extraordinary aspects of The Shining is the way the simplest events in bright light conjure dark fears, guesses and portents.”
WATCH: The Shining -- Who Is The Man In The Bear Costume?