https://www.google.com/amp/s/www.mlb.com/amp/news/all-star-game-roster-rules-faq-c239654292.html
Used to be manager, but that changed in 2017 to eliminate bias.
Who picks the replacements for injured players or those who decline to participate?
If a fan-elected starter is unable to play, they are replaced in the starting lineup by the player on the roster who received the next most votes on the player ballot at their position. The roster replacement is then chosen by the league.
If a player-elected reserve position player must be replaced, the next in line on the player ballot becomes a reserve, unless the leaders of the player ballot have already been accounted for. If the top finishers on the player ballot are already All-Stars, then MLB can select another replacement.