Headmath,
As others have observed, your friend flipping out in his late teens early twenties, trying to do something superhuman and claiming to be god is a textbook example of a bi-polar disorder 'break'. He also was probably going days at a time without sleeping and was spouting quasi religous/metaphysical drivel. We went through this with our youngest son. Less than a week after he was a passenger in a very traumatic auto accident from which he ermerged uninjured, physically, he started showing signs of what we now know was mania. Ultimately, it was some very good hospitals (regular hospitals with mental health units), drugs and counselors that got him straightened out a few years ago.
I encourage you to offer your company to him if that is possible. Talk about the problem openly with him. This is when a young person needs good friends.