Heat the olive oil in a saucepan over medium heat, then add the onions and garlic. Cover and cook for about 15 minutes stirring every now and then and adjusting heat as needed to make sure they don't burn. Remove the lid and stir in the sugar and salt. Cook uncovered, stirring as needed until the onions have caramelized, another 5 - 10 minutes.
Use an immersion blender, food processor, or blender to combine the silken tofu and vegan mayonnaise. Set aside a spoonful of the caramelized onions to use as garnish (optional), then add the remaining onions and pulse a few times or stir to incorporate. Chill in the fridge in an air-tight container for several hours or overnight to thicken. Serve with chips or veggies for dipping.