Given that other responses are quite US-centric, here a counterpoint: in Germany (and possibly many other continental European countries), there used to be no pressure for grant money for regular-sized research, as departments endowed their professors with sufficient funds for typical research in their field. Exceptions would be large-scale projects which required significantly increased budgets or special governmental programs one could apply for.
About the '00s, this model changed and increasingly the US model was adopted. It is difficult to point to a specific reason why this happened. Notably, German universities are typically getting their money from the state and not from endowments, so essentially, this constitutes a redistribution of governmental funds in what is considered a more competitive process. It is not clear whether this is indeed the most effective use of funds, as now researchers time is invested in the process of writing proposals, reviewing them, writing reports etc., all including the high failure rate of such proposals increasing the volatility of research funding continuity and high churn.
As for the argument of overheads, again this is effectively just an accounting model. In the UK, it was explicitly changed from a "the university pays for the infrastructure, the government pays the salaries and equipment" to "everything is separately accounted for".
It is again not easy to disentangle to which extent this has really changed how money is being used or whether it is now used more appropriately; many such accounting rules are conventions, but one consequence is that it changes price tags on projects, reducing fundable project volume, while the institutions need to run their infrastructure whether or not they run a project.
There is no question that there are ambitious project ideas that require funding beyond the regular and for this, funding is essential. However, the idea that even the funds for regular research activity needs to be competitively applied for has distinctly originated in the US, due to the specific structure of the US university funding model.
It is not clear at all that the European university funding model needed such a strong veer towards the US research funding model; it was a specifically political decision.
One possible explanation was the intention to save money. If that was the intention, it is not clear whether it was successful, because with the significant friction of competitive funding processes, the output per invested money may actually have gone down instead of up (note that in, say, Germany, this is mostly government money anyway, whether in the universities, or the funding agencies).
A second possible explanation is the desire for competitiveness. The idea is that researchers with higher quality research should get more money. This may be partly working, but it also favours proposal-churning models of operation and not-too-adventurous and risk-averse research, no matter what the calls say. Very outlandish projects are not likely to be funded.
A third possible explanation is gatekeeping. Funding distribution models permit more influential researchers (and political agents)
to direct research agendas. Instead of curiosity-driven research, this enables agenda-driven research. To be fair, if one bewails the loss of curiosity-driven research, one should remember that over most periods, research was mostly agenda-driven, whether alchemists hiding gold dust in their oven, or Galilei giving out telescopes to his patrons. The concept of a curiosity-driven scholar thrived in particular pockets of time and space and was never a universal feature of university. Nonetheless, one will notice that some of the most lasting and celebrated achievements of science emerged from permissive niches of curiosity.
These are several reasons I am aware of, maybe I will extend this list with additional ones.
Whatever the reasons, with the adoption of the US-type perspective on research funds, university gain not only money, but prestige from being able to acquire grant money. As such, grants are considered a way to measure the research prowess of an institution, with large grants indicating more prowess. Funding volume follows scientific excellence with significant delay and averaged over time - rarely does the volume of a project directly correlate with its scientific value (with some exceptions, again, such as large-scale instruments and experiments).
While ostensibly universities need grant money to fund personnel and overheads, in its basic form, this is a US-centric perspective. For Europe, this is not ultimately an explanation, as there used to be different funding models for universities. The move towards a competitive grant-based funding model has many potential reasons, ranging, for instance, from the desire to increase competitiveness, save money, or be able to set the agenda of scientific research.
As such giving importance to external funding is a political decision, and as consequence, European universities have begun to vye for grant money not only for reasons of finance, but also of prestige, power and influence.