score:8
Can I apply for a visa from the USA although I will leaving for Spain from India?
Your point of departure is irrelevant. You must apply from your place of residence. Whether the consulate will consider you to be a resident of the US depends in part on your immigration status in the US. If you are in B-1 or B-2 status, you will be unable to apply in the US, with only limited exceptions. If you are in some other status, for longer than six months, then they are more likely to accept your application.
But you probably should not apply at the Spanish consulate. You must apply to the country that is the main destination of your trip. If the main destination cannot be determined by the purpose of your trip, then you should look at the duration of stay, and apply to the country where you will spend the most time, which is Hungary.
Do I have to apply for a student visa there or tourist visa as the available dates in Spanish consulate for a tourist visa is 7th of May(that is impossible for me) and for student visa there are many dates?
A Spanish student visa is a long-stay visa that requires you to be enrolled in a university in Spain. You need a short-stay visa (sometimes called a "tourist" visa).
Then will applying for the visa in one consulate be enough as this will be Schengen visa as per my knowledge?
Yes, you should get a single Schengen short-stay visa. Unless there is something related to the purpose of your trip that makes Spain the main destination, check the appointment times at the Hungarian consulate.