Basically, Sandman becomes Sandman due to a series of unexpected events and circumstances. It involves a mixture of technological mishaps and supernatural influences that shape his destiny and give him his powers and form.
Well, it all started with a strange accident involving some sort of magical dust or substance that transformed him. But the details can get pretty complex.
The transformation of Sandman in the comics is a result of a combination of factors. There's a science experiment gone wrong, exposure to a rare energy source, and a touch of fate. All these elements come together to turn him into Sandman.