At the beginning of a startup's journey, the most important asset are the people. The startup depends on the commitment of the founders to work through any obstacles to make things work. Vesting is one way to provide a structural incentive to encourage founders to stay long enough to make the venture work.
Conversely, if founder shares are granted outright without vesting, a startup could find themselves in a difficult situation where one of the cofounders decided to exit the venture. They would take all their shares with them and there is no further value they deliver to the venture, yet the remaining cofounders will not have any recourse to get the equity back.