The Cave of Origin is near the end of the game. Before entering it, you must reach Mossdeep City and win the Mind Badge from Tate and Liza at the gym. This badge is necessary as it grants the ability to use Dive outside of battle, which you need to get through Route 126 and into Sootopolis.
The cavern can now be reached by using Dive in the dark waters south of Mossdeep. At the end of the cavern, you must battle and defeat Maxie. The legendary Pokémon that Maxie was attempting to control then escapes, changing the weather conditions back on the surface.
Once the Seafloor Cavern is cleared, you can reach Sootopolis by way of Route 126. Find Steven in the north part of the city. Steven refers you to his friend Wallace in the Cave of Origin. You now have access to the cave.
Use the Flash technique inside the cave to light it up and see where you're going. The path through the cave is linear, so HM 07 is clearly visible.