Get chat message data from table, grouped by date
Lots of little pieces of advice:


Tab the lines of code inside of your loops and functions (etc) for improved readability.
Only declare the $key variable in your foreach() loop if you intend to use it.
Avoid performing iterated trips to the database.  Furthermore, always endeavor to minimize total trips to the database unless you have a data volume issue to contend with.
Use meaningful variable names.  $checkArr does not speak clearly of the data that it holds.
Quote your associative array keys.
You aren't filtering out any dates between the two selected users, so you can avoid calling date-fetching queries entirely.
After writing your WHERE condition to isolate the messages between the pair of users, sort the rows by descending datetime.
Use all uppercase for MySQL reserved words for clarity / readability.
Before return $data, you can run a simple loop to group the message data by date.  Use the date value as the first level keys and just push the row data as subarrays.


Suggested single query: (well... really I recommend a prepared statement)

$query =
"SELECT DATE(date_added) AS `date`, sender_id, receiver_id, `msg
FROM tb_chats
WHERE
  (sender_id = " . (int)$checkArr['sender_id'] . " AND receiver_id = " . (int)$checkArr['receiver_id'] . ")
  OR
  (sender_id = " . (int)$checkArr['receiver_id'] . " AND receiver_id = " . (int)$checkArr['sender_id'] . ")
ORDER BY date_added DESC";


Grouping with php:

foreach ($data as $row) {
    $grouped[array_shift($row)][] = $row;
}
// this step can be performed in a number of different ways according to style preference / micro-optimization
return $grouped;


I don't know code igniter, so if the grouping can be done with an available function, I don't know it.