The reasons can be hugely variable.
No two people are ever the same.
One position could be that no two people are created equal. If the new grad had some particularly valuable skill set that you do not, then the company may be willing to pay for it. There's hot technology, and there are definitely "fads" out there where a given particular skill set will be the jackpot. Same could go for any difference in your two backgrounds. Maybe he's from a hot shot school. In this case, "hot shot" could be some place with an insanely good reputation, or it could be some place that the biggest boss graduated from and it's perceived value is far beyond it's actual ability to impart engineering prowess. Maybe he had a very competitive offer from the business competition, and/or he interned with some key business competitor.
Right Place, Right Time
Not every company is good at baselining their salaries. If he's got a different manager or is in a different department, organization or project from you - they have had bargaining power that your hiring manager/organization did not. Companies vary hugely this way, and a pet project with a better budget can easily be less frugal than a more carefully scrutinized counterpart.
Similarly, even a 6 month spread can drastically change the hiring market.
Less Savory Reasons
I like to think that the first two are more likely, but let's face it, the world isn't always nice or fair. Often getting into the blacker side of ethics is a slippery slope with far too many ways to easily justify inappropriate behavior.
Nepotism - he could be related to someone.
Diversity - he could be a strong enough diversity candidate. If he's a justifiable minority and your company has had trouble recruiting and yet must meet metrics - it can happen. The ideal world of diversity would be that opportunities are really equal - may the best candidate win. The harsh side is that limitations in opportunity to get education or exposure to science and engineering during the early parts of life means that there are fewer minority candidates available in the labor pool. Scarcity leads to increases in price.
Ageism - it sucks but the legal protections around it can be highly variable. In the US, there's a cut off age (?50?... I forget) for what is protected in terms of age discrimination. But flat out "we won't hire you because you are old" is rarely the case... balancing age in light of the complexity of characteristics a candidate brings to the table is more likely and more difficult to sort out.
There's no real way of knowing without digging much father into this than would be considered appropriate or polite. Unless your company has a salary disclosure policy, you've already found out something that would be privileged information. Digging further on why may not be in your best interest.