Note: All links in Spanish (sorry).
Regardless or your father being or not the legal owner of the home, the issue at play is that of
This is an obligation between some family relationships to help each other so if family member (the alimentista) is in dire need of help (i.e., needs the help to survive) the others have the obligation to provide the help.
The relatives of the alimentista affected are, in order:
The couple, always when married and only when expressly agreed upon for non-married couples.
Descendants: sons/daughters and grandsons/granddaughters.
Ascendants: parents and grandparents.
Brothers: Only when indispensable and the minimum amount.
The order determines who of all the family members is under obligation to provide the help; in case of multiple people in the same category the amount is to be divided between them in function of their income.
The amount of the help is not fixed and will depend of the circunstances of the situation2; and it is possible to provide by providing the needs(shelter, food) directly.
Now, until when does a father/grandfather need to provide alimentos to a son or daughter? Certainly until s/he is 183, as this is the date of full age in Spain, but it is usual to consider that the obligation exists while the alimentista is studying and lacks of his/her own means of subsistence.
That is not a "free rider" situation, as alimentos may be denied by several reasons:
Obviously, because the person that should provide the help does not have the means to do so without endangering his own subsistence.
The alimentista gets his/her own means of subsistence.
Any of the causes that would make the alimentista unable to inherit from the person providing the help4: attempted murder, coercion to change their will, and other grave crimes.
The alimentista does not do enough to get his/her own means of subsistence. If a judge decides that the alimentista son/daughter is neither studying nor seriously trying to get a job, the help can be revoked. Judges seem to be progressively taking a harsher stance against descendants who refuse to do their part. The article quotes the case of a 19 years old guy whose claim to the pension was denied.
As a side note, rejecting to pay alimentos is another of the causes that would cause the person doing it to lose any right to inheritance from the alimentista.
If for whatever the reason you do not qualify for alimentos, the details of the agreement between your father and your grandfather for the home become relevant5:
If your father has formally rented the house then your grandfather position is not relevant, as your father has all of the rights6.
If your grandfather allows your father to live in the house without paying rent, then it is your grandfather rights as owner against your father rights as an occupant. No idea about the outcome of that situation.
You still do not tell about your grandfather stance about the issue, which is important. If your grandfather agrees with your father7 then the only way to stay at home is that of alimentos.
What you describe is a situation of either precario or comodato, where your grandfather allows the use of the home without compensation. The differences are:
Now, I have to suppose that you are not part of the agreement so it is just between your father and grandfather. That makes it your father's dwelling, and beyond alimentos he cannot be forced to share his dwelling with you.
But if this is a situation of precario (which is what most often happens) your grandfather has the "nuclear option"8 of threatening to evict your father, as it is a relatively easy (in the legal sense, not the personal one) procedure. In a situation of comodato your grandfather could not evict your father until the conditions of the cession expire, making threats somewhat weaker.
As a final note, and given how specific this answer has become:
I am not a lawyer, you have not provided enough specific info, and this is not legal advice. Talk to a lawyer. Maybe a lawyer will check the agreement and it will turn out that your father is paying rent by performing some service, voiding the precario aspect. Maybe with the details provided the lawyer can find a way to an agreement that is more amenable to all. Talk to a lawyer.
Shut up. The issue at hand may be stressful, and sometimes it might be tempting to boast to your father about the issues of alimentos or precario. Don't. If there is something to be said about that, let your lawyer do the talking. Try to stay calm.
Consider the effect of your actions before taking them. While there is nothing wrong with talking to a lawyer, going beyond that and beginning a legal battle with members of your own family is most of the times an ugly affair. It could easily have an effect for a very long time in your relationship with most of your family, even with those who are not directly implied. Try to stay calm.
1 Literally, "foodstuffs", but when used as a legal term it includes other basic needs.
2 There are some official guidelines but judges seem to have freedom to follow them or not.
3 I believe that there are some exceptional reasons to lose such right before becoming 18 (e.g., sons condemned of attacking their fathers and the like) but I have no specific data about those.
4 As a side note, in Spain last wills do not allow the "donor" to distribute the goods freely, as some porcentajes of the inheritance must obligatory be provided to descendants and widowers.
5 Of course, in the case that your grandfather wanted to oppose your father's decision.
6 Since one of the legal reasons to end a rent agreement is to provide a home for a first degree relative, your grandfather could expel you from your rented home to give it to your father, but not the other way around.
7 And "agree" does not mean "Is happy with the decision" but "Will not go to the court to challenge your father decision".
8 Which is a very relevant analogy, because it could be almost as damaging to your family as a literal nuclear bomb.