The etymology of apricot on the Merriam-Webster site states that it was previously abrecock, adapted from Arabic. This site has a bit more detail, and suggests that the change from abrecock to abricot took place first in French.
The etymology of the French haricot doesn’t seem to shed any light on the similarity of the words.
Despite the apparent dissimilarity in etymologies, the coincidence has me suspicious. Is there any reason to suspect that the change to -icot was a natural move considering that the ending was already in use for another edible agricultural product?
And, are there other such words with that suffix, either in English or French? I don’t think dicot and monocot qualify, as they seem to be simply abbreviations of longer unrelated words.
Fricot (de veau): veal shoulder simmered in white wine with vegetables.
Persicot: A cordial made of the kernels of apricots, nectarines, etc., with refined spirit.
Alicot: A stew made with poultry giblets, traditionally linked to the Béarn and Languedoc regions of France.
There seem to be lots of -icots with culinary links. Interesting.