It’s a personal question, so I’m more comfortable answering this as Ryan (myself) instead of being Stephen if that’s okay.
At first Stephen became very depressed. Being told ‘you don’t have much time to live’ left him despondent and inconsolable. Stephen described two key moments during the first few months after his diagnosis that helped him recover. The first was while he was still in hospital. He shared a room with a young man suffering with Leukaemia; Hawking felt his suffering was more tolerable relative to his poor roommate’s. The second moment was a dream Stephen had, in it he was executed. Upon waking from his nightmare, Stephen felt he still had so much to live for.
Prior to his diagnosis, Stephen didn’t have much direction in his life. After this, he realised what it was he wanted and poured more effort into his research and career. With the uncertainty in his life he wanted to make sure he got his PhD. From there, became one of the best theorists in the world!