Why is the President allowed to campaign for a candidate? Are there any restrictions to this?
The answer to your question is there is nothing that prevents the incumbent President from campaigning.
You should note that President Obama and Vice President Biden are elected officials. In this sense, they are different from other government employees who are not elected.
There are no federal laws that prevent them from campaigning for other candidates they endorse. However, if they use the government resources such as Air Force One, the expense calculated in accordance with relevant law should be reimbursed by the campaign.
Because free political thought and speech is a cherished and protected right in the US. Regardless of how corrupted the government has become the founders realized that there was always a chance to right the ship as long as the people can talk about the realities of the people running the government.
This extends to every person in the country including the president.
When using government Facilities for election events the venue must be made available to all candidates for use at comparable times. So say Obama decided to do a speech in support of Hillary from the oval Office tonight then They would have to make accommodations for all of the candidates who wish to use the Oval Office during a comparable time slot. So the blanket rule is no campaigning in places that are not open for public gatherings anyway.