Part II begins with:
Siddhartha learned something new on every step of his path, for the world was transformed, and his heart was enchanted.
So, Hesse uses Part II as a period transition for Siddhartha: he is awakening to the material quest for physical pleasure. He learns how to make money, gamble, and enjoy sex. He pursues these three out of mere curiosity--to experience that which the worldly man desires in order to more easily give it up later when he is to seek nirvana. After all, one must be in the world and experience its pleasures in order to leave it later.
On desiring sexuality, Hesse states:
Siddhartha also felt desire and felt the source of his sexuality moving; but since he had never touched a woman before, he hesitated for a moment, while his hands were already prepared to reach out for her.
And after each big loss, his mind was set on new riches, pursued the trade more zealously, forced his debtors more strictly to pay, because he wanted to continue gambling, he wanted to continue squandering, continue demonstrating his disdain of wealth.
On clothes and moeny:
"Simple is the life which people lead in this world here," thought Siddhartha. "It presents no difficulties. Everything was difficult, toilsome, and ultimately hopeless, when I was still a Samana. Now, everything is easy, easy like that lessons in kissing, which Kamala is giving me. I need clothes and money, nothing else; this a small, near goals, they won't make a person lose any sleep."
All of the desire for the material is a curious game for Siddhartha, but it does not give him inner peace. He realizes this at the end, and he decides to pursue the life of an ascetic again. He forsakes money, gambling, and sex in favor of thinking, waiting, and fasting. He tells Kamala:
Everyone can perform magic, everyone can reach his goals, if he is able to think, if he is able to wait, if he is able to fast.