In a large pot over medium heat, cook bacon until crisp, about 8 - 10 minutes, stirring frequently. Using a slotted spoon, remove bacon and reserve on a paper towel-lined plate. Reserve 2 tablespoons of the bacon fat in the pot.
Add onions and sugar and cook, stirring occasionally, until softened and beginning to brown, about 10 minutes.
Add garlic cloves and apples, and cook until soft, about another 10 minutes.
Add vinegar, maple syrup, cayenne pepper, dijon mustard, reserved bacon and ½ cup water to pot. Increase heat to high and bring liquid to a boil. Reduce heat to medium-low and cover. Cook mixture for 20 minutes, stirring from time to time, then remove the lid and cook for another 20 minutes, stirring occasionally. At this point the jam should be thick and glazed. Remove from heat and let cool before serving.
Recipe by Allons-Eat! at https://www.allonseat.com/apple-bacon-jam/