A video of Fognini showed him muttering the Italian word 'zingaro', meaning gypsy, while he had his back to Krajinovic during Wednesday's match.
After it was picked up on social media, Fognini tweeted: ''I made a mistake. I didn't want to offend anyone. ... I know Filip very well and anyone who plays sports knows that at times you get carried away saying things that make no sense.''
Krajinovic, a 149th-ranked qualifier, won 6-4, 6-0 against the defending champion and second seed.
The temperamental Fognini also broke his racket in half by stepping on it as he headed to a changeover midway through the second set.