Let x be the amount of the 30% alcohol and let y be the amount of 5% alcohol.
We want the total amount to by 25 gal, then we have:

We also want the resulting mix to be 25% alcohol, this is 0.25 in decimal form; also we know that the first type of alcohol is 30% and the second is 5%, then we have:

Hence we have the system of equations:

To solve the system we solve the first equation for y:

then we plug this value of y in the second equation:

Once we have the value of x we plug it in the expression we found for y:

Therefore, the mixture will have 20 gallons of 30% alcohol and 5 gallons of 5% alcohol.