Well, we have no way of knowing for sure. We don't even know if Hong Xiuqing truly believed his claims of divinity, or if all those visions and such were just a useful story for a conman to create a personal power base.
Hong Xiuquan was born in 1814, and while he qualified to take the exam he failed his first attempt at the lowest level shengyuan degree in the early 1830s. That's certainly a disappointment, but failing in the exams at a young age was not at all unusual. In 1836 Hong was supposedly handed a collection of Protestant tracts by a Chinese evangelist as he headed towards his 2nd examination. Hong again failed to pass, but he also didn't pay any real attention to the tracts, keeping them but not reading them.
In 1837 he failed the exams a third time, and shortly afterwards he fell into a delirium where he (supposedly) had strange visions about a old man and an elder brother, who taught him how to slay evil spirits. After this vision Hong... well, he didn't do much, he got a job teaching in a small village for the next 6 years. Only after he made a last attempt at the exams did he finally return - supposedly by chance - to those old tracts he had saved where he realized that the old man of his vision must have been God, the elder brother was Jesus, and therefore that made Hong Xiuquan the younger brother of Jesus.
Judging by his actions in this period, it seems safe to assume that he was fairly genuine in his beliefs. He began preaching publicly and destroying Confucian ancestral shrines, which unsurprisingly quickly got him kicked out of his old village. By 1847 he was in Canton studying the bible with Isaacher Roberts, a southern Baptist missionary. He didn't stay long though, and by 1849 he was leading 10,000 followers based on Thistle Mountain, in eastern Guangxi province. His followers were largely fellow Hakka - a Chinese minority group - and called for the destruction of the old Confucian order and the expulsion of the Manchu. By 1851 he declared himself the Heavenly King of the Taiping Tianguo, the Heavenly Kingdom of Great Peace.
You could interpret Hong as defined by his ethnicity first, a resentful Hakka who felt that he was blocked from passing the Confucian exams as a Hakka and so sought to destroy the Confucian system. There had certainly been other revolts before this against the Qing which used religious populism to fuel their movements, and Hong could have been purposefully borrowing from them. He certainly would have heard of them as a well-traveled and well read degree applicant. Or perhaps he was a true blue religious lunatic - he certainly proved incapable of moderating his religious claims, alienating both westerners who may have been interested in supporting a less-crazy Christian movement as well as other Chinese revolutionary groups. Some combination of the two is probably most likely, but there's no real proof that it was stress that led to his beliefs.
For more, The Search for Modern China & The Search for Modern China: A Documentary Collection, both by Jonathan Spence.