How to use apply_filters(‘get_calendar’) to change get_calendar() output?

The get_calendar filter hook will allow you to modify the HTML generated by get_calendar() prior to displaying it. Duplicating the get_calendar() function in your functions.php file will throw a fatal error, since you’ll be redeclaring an existing function. (You can get around this by calling it something else, like function wpse410569_get_calendar(...), but I’d recommend using the filter hook, since that’s what it’s there for.)

To modify the output the way you need, add this to your active theme’s functions.php file:

add_filter( 'get_calendar', 'wpse410569_modify_calendar' );
function wpse410569_modify_calendar( $calendar_output ) {
    $search="<span class="wp-calendar-nav-next">&nbsp;</span>";
    $replace="<span class="wp-calendar-nav-next"><a href="#">My link</a></span>";
    $calendar_output = str_replace( $search, $replace, $calendar_output );
    return $calendar_output;
}

To learn more about how filter hooks work, consult Filters in the Developer Handbook and/or check out the Filter Hook tutorial video.