Short answer: he was seeking liberation
According to traditional Buddhist accounts, Siddhartha Gautama starved himself because he believed extreme self-denial might lead to freedom from suffering and the cycle of rebirth. After leaving his home, he is said to have tried the harshest ascetic practices of his day. He later concluded that they did not bring the understanding he sought, and he gave them up.
The ascetic tradition of his day
In ancient northern India, many wandering seekers held that the body and its appetites bound a person to suffering. Fasting, holding difficult postures and controlling the breath were seen as ways to weaken that hold and purify the mind. Such practices were not unusual, and several religious movements of the period, including Jainism, valued strict austerity.
So when Siddhartha left his comfortable life, taking up these methods fit the spiritual culture of the region where Buddhism originated.
What the traditional accounts describe
The texts say he first studied meditation under teachers, then practiced severe austerities for some years, joined by a small group of companions. Accounts describe him eating very little, sometimes only tiny amounts, until he became extremely thin and weak.
The precise details, including how long this lasted and how little he ate, vary between sources and are often vivid in a way that suggests later embellishment. It is safest to say that tradition describes a period of extreme fasting, without relying on specific numbers.
Why he gave it up
The accounts say he came to see that nearly starving the body left the mind too weak and clouded for insight. He reasoned that this path was as unhelpful as a life of indulgence. In the traditional story, he accepted food, often described as a bowl of rice milk offered by a woman named Sujata, and regained strength. His companions, who still believed in strict austerity, are said to have left him in disappointment.
Soon afterward, the story continues, he meditated at Bodh Gaya and attained awakening, becoming the Buddha. His full biography is summarized in the real name of the founder of Buddhism.
The Middle Way that resulted
This experience is closely tied to the idea of the Middle Way, which avoids both indulgence and extreme self-denial. The Middle Way later became linked with the Noble Eightfold Path. If you want to know more, read why is the Noble Eightfold Path also called the Middle Way.
What it means for Buddhists today
Buddhist monastics follow disciplined rules, such as the common practice of not eating after midday in some traditions, but these are moderate rules for training the mind rather than a program of starvation. Many Buddhists take the story as a reminder that balanced effort works better than harsh extremes. Whether the episode happened exactly as told cannot be verified, but its message is central to the tradition.