Well first of all your resource collection will expect to get a one dimentional array (or collection) with the data. That means that it will not work if you pass in the grouped records.
You should be able to do something like this.
$records = $records->newQuery();
$records->where('user_id', auth()->id())
$records->where('active', true)
$allRecords = $records->get();
$groupedRecords = $allRecords->groupBy(function($item) {
return $item->date->isPast() ? 'past' : 'upcoming';
});
return [
'upcoming' => RecordsResource::collection($groupedRecords['upcoming']),
'past' => RecordsResource::collection($groupedRecords['past']),
];