The heavy elements in a star (and its planets) come from previous generations of stars having 'lived', produced them, and 'died'. So there are many red dwarf stars that happen to have inherited a fair bunch of heavy elements from their predecessors that were local to them at time of their formation