In a large pot, heat the olive oil over medium heat. Add the diced onion and sauté for about 5 minutes until softened.
Stir in the minced garlic, diced carrots, and diced celery. Cook for an additional 5 minutes, stirring occasionally.
Add the rinsed navy beans, ham hock, chicken broth, dried thyme, and bay leaf to the pot. Bring to a boil, then reduce heat to low and cover.
Simmer for about 1.5 to 2 hours, or until the beans are tender and the ham hock is falling apart.
Remove the ham hock from the pot and let it cool slightly. Shred the meat from the bone and return the meat to the soup, discarding the bone and any excess fat.
If using, stir in the chopped kale or spinach and let it wilt for about 5 minutes.
Season the soup with salt, pepper, and apple cider vinegar to taste before serving.