I am trying to replace a string with other from function.php

The str_replace() function should have 3 parameters, so your code should be like this:

echo str_replace(
    'class="fa fa-play mi"',
    'class="fa fa-play mi" aria-hidden="true"',
    '<i class="fa fa-play mi"></i>'
);