Based on the little information you provided: “it depends.”
I think perhaps the most straightforward way is to save the images in 31 folders numbered 1 to 31 and add pictures that correspond to each day in them. ideally, you would want to keep a consistent file naming convention when it comes to dates. For example:
In PHP, you could do something like this (not tested):
$today = date('j'); // the day value without leading zeros. See [PHP date formats](https://www.php.net/manual/en/datetime.format.php)
$path = '/your/path/to/images/folders/';
$files_array = glob(realpath($path . $today) . '/*.*'); // creates an array with the filenames in the given folder
$random_file = array_rand($files_array); // pick a random file.
$random_image = $files_array[$random_file];
$image_date = substr($random_image, -14, 10); // will give you the date of the image file
$on_this_day_caption = 'On this day, ' . date('F jS, Y', strtotime($image_date)) . '...';
Now you should have something to work with your html file:
<img src="<?= $path . $image_file ?>" alt="<?= $on_this_day_caption ?>">
Although I am not sure what you mean by “then be removed”, I hope this will help you get started.