I don't think there's a clear and definitive reason. The Nondischargeability of Student Loans in Personal Bankruptcy Proceedings: The Search for a Theory by John A. E. Pottow of the University of Michigan Law School explores the very question you ask here. It provides 6 six reasons for making student loans nondischargeable. I'll try to summarize those reasons a bit by quoting some introductory paragraphs for all six reasons.
Section three of the linked paper focuses on your question:
III. POSSIBLE THEORIES FOR NONDISCHARGEABILITY
U.S. bankruptcy law treats student loans as nondischargeable
debts. Why is that so? There are several plausible theories under
which educational debt should be treated as nondischargeable.
The six reasons provided by the article are as follows (note that the article itself provides more details than the limited quotes here):
Fraud
One long-standing reason for holding bankruptcy debts nondischargeable is fraud. Accordingly, one theory for subjecting
student loans to a nondischargeability rule is an assumption that
they are presumptively fraudulent.
Elaborating on what fraud means in this case:
To say that a loan is fraudulent is to say, or postulate as a
rule of thumb, that students intend to take out huge sums of money
with no intention whatsoever, from the ex ante perspective, of ever
paying them back. While it may be a dramatic assumption, it is one
that would provide a sound theoretical basis for a nondischargeability rule.
Soft fraud
A more likely fraud-animated foundation for nondischargeability
of student debt is what might be called "soft fraud", although that is
an imperfect label. "Opportunism" also captures the concern, but
that too is problematic because "opportunism" is a notoriously
amorphous concept in bankruptcy.
To elaborate what soft fraud means in this case, the article provides the following example:
In any event, the opportunism concern of "soft" fraud is as
follows: Perhaps without the malice aforethought of traditional
fraud, Student takes out a six-figure loan to finance her undergraduate
and graduate education. [...] Her first year out into the real world, however, hardens her. She realizes she faces the prospect of amortizing a multidecade loan, when she has few personal assets to her name other
than well-highlighted law books. She has no appreciable savings (as
a rational life cycle consumer, she had no inclination to accrue them
yet), no home, and perhaps a beat-up car at best. But she has lots of
difficult-to-monetize, let alone liquidate, human capital in the form
of her J.D. degree.36 Recognizing that the price exchanged for the
bankruptcy discharge is giving up all her non-exempt assets, she
happily trades in the car for unfettered access to that high future
income stream. There is a perverse temporal arbitrage of sorts. She
gets to pick her debt relief at the point in time when her realizable
assets and present income are at their lowest and her debt and future
income are at their highest. Her impecunity is transient and arguably
artificial.
Internalization
This theory builds on the notion that the recipient
of a private benefit (here, education) should have to bear its cost
(here, the debt for tuition).
As the article explains through the example of future lawyers and who pays for them:
If tuition debt is publicly subsidized and then discharged, the benefit is realized privately but the cost is shifted back
to the public. Indeed, some enthusiasts of "constructing"'" education as a private benefit go even further. Here, it is not even higher
earning, but the chance for higher earning, that is the private benefit of education. The unsuccessful lawyer must bear that cost just as
much as the successful one, lest the taxpayer fall into the role of
guarantor of financial success (of lawyers!).
Shaming
The article mentions that this is probably not the main reason, but that it is a "logically coherent rationale" nonetheless.
The argument is that students fall into a class
of morally deficient debtors whom society wants to stigmatize and
punish for non-economic reasons. Indeed, as mentioned, a paradigmatic nondischargeable debt is the intentional tortfeasor's.
Public Fisc
A wholly different justification for treating student loans as
nondischargeable in bankruptcy proceedings is couched in terms of "protecting" the solvency of the public student loan programme,
which is perceived to be in a crisis.
As the article goes on to explain:
If bankruptcy law treats student loans leniently, then more
students at the margin will be inclined to "take bankruptcy" and discharge their loans. And if more students discharge their federally
insured loans in bankruptcy, then more federal dollars will be
devoted to bailing out failed loans (and reimbursing guaranteed
lenders) than might otherwise be devoted to making initial loans to
new students. Here, bankruptcy policy becomes an indirect lever for
education policy. If bankruptcy policy can be altered to make it
harder to default on student loans (e.g., changing otherwise dischargeable debts to become nondischargeable), then incentives will
change.
Cost of Private Capital
If an otherwise
dischargeable unsecured debt is rendered nondischargeable by the
law, then the bankruptcy-state scenario regarding that debt becomes
worse for the debtor (it does not go away) and better for the lender
(it does not go away). In a world of competitive, zero-profit lending
markets, this increased payoff for the lender must be translated
ex ante into an improved cost of capital for the borrower. Without
addressing the empirical likelihood of this competition, it suffices
to observe that making bankruptcy harsher for the debtor, at least
from the standpoint of economic theory, makes borrowing more
affordable for that debtor in particular and all borrowers generally
(especially in a world where it is difficult or expensive to distinguish good from bad borrowers up front).
In other words, because the risk associated with these dischargeable loans is lower from the lender's perspective, the free market should lower the cost of borrowing for all debtors.
Also adding the recommended citation for the source of the quotes:
Pottow, John A. E. "The Nondischargeability of Student Loans in Personal Bankruptcy Proceedings: The Search for a Theory." Canadian Bus. L. J. 44, no. 2 (2007): 245-78.
While this answer doesn't specify which reasons actually came up when the law was debated, it does provide a number of arguments that defenders of nondischargeable student loans would give.