Like diverting meteor path away from Earth, or blasting giant asteroid which was expected to impact Earth, etc.
Has any space agency saved Earth from a major calamity at any time?
More fundamental, and a question if it counts as a 'space agency' act being NOAA led but weather satellites not only reduced the fatalities associated with weather data collection but increased the number of dangerous weather events to be forecast days rather than hours in advance.
It is arguable that for areas with large amounts of ground stations available it would be possible to work without satellite data, but for areas where the weather comes from over the ocean expensive and risky networks of surface ships* would be required, especially when the most important time to have them at sea is when extreme weather is likely. Satellites are mostly immune to the extreme weather they measure.
*While weather buoys exist for surface data, in the absence of satellite upper atmosphere data something capable of doing balloon and radar operation would be required, probably requiring crewed ships.
Ozone depletion was hypothesized and first measured without the means of satellites according to the wikipedia article. However, satellite data was apparently very helpful in showing the scope/size and history of the problem, which led to a rapid change in public policy, thus reducing the harm inflicted.
Has any space agency saved Earth from a major calamity at anytime?
There are historians who believe that the US–Soviet and US–Russian collaboration, for example in the Apollo–Soyuz Test Project, the Shuttle–Mir Project, and ultimately the merging of Мир-2 and Space Station Freedom into the International Space Station had at least a partial hand in preventing the Cold War becoming hot, including preventing a Nuclear War.
As yet, no space agency has blasted anything that may have posed a hazard to Earth. One of the issues with blasting such hazards is the numerous fragments of the blasted object may pose a greater risk to Earth than the larger singular object.
In such instances it would be better to blast near the object to alter its course. One of the problems with this is such objects are usually detected when it is too late to act.
So far, all that agencies can do is warn us of threats or potential threats, such as comets, asteroids, solar flares and high energy beams.
Like diverting meteor path away from Earth or blasting giant asteroid which was expected to impact Earth etc.
However, later this year (between 26 September 2022 and 2 October 2022), NASA's and ESA's Double Asteroid Redirection Test mission will (attempt to) alter the course of the asteroid-moon Dimorphos with a kinetic impactor.
Note that this test is deliberately performed with an asteroid that is not Earth-crossing to avoid accidentally knocking it into a collision course. So, it does not quite the bill of "diverting away from Earth", but it is "diverting".
No, it hasn't happened, no matter what some people may want to believe. If anything, the opposite is actually the case.
In 1983, a Soviet human operator Lieutenant Colonel Stanislav Petrov has saved Earth from a Soviet space agency maintaining an early-warning system named "Oko" (eng. "Eye) whose false alarm could have caused a total disaster of nuclear war. On September 26th, 1983, that system reported supposedly a few nuclear missiles approaching USSR, and the official procedure was telling Lt Col. Petrov to report that to his superior who would almost certainly had launched an enormous retaliatory strike as means of mutually-assured destruction. Lt Col. Petrov correctly came to the conclusion that it was a false alarm since it made no sense for, and dismissed the alarm as invalid, most possibly saving life on Earth from destruction.