The location services feature on your iPhone allows location-based apps (like Maps, Yelp, Camera, etc.) and websites to determine your location based on information from GPS, Wi-Fi, cellular and iBeacon networks. If you have location services enabled, your iPhone will keep track of places you have been, when you were there and how often you've been there. If you want to see this information, here is how you do it in iOS:

Go to Settings -> Privacy -> Location Services. Scroll all the way down and go to "System Services." Go to "Significant Locations" at the bottom. Enter your passcode if prompted, or verify with Touch ID or Face ID. Scroll down and you will see a "History" section that lists places you have been. If you tap on a location you can access more detailed information, including a map with more specific locations marked on it. Tapping on one of these will show you dates and times that you were there. It is interesting to see where and when you've been to various places, but if you are uncomfortable with it you can always turn the service off by going to Settings -> Privacy -> Location Services -> System Services -> Significant Locations and toggling the switch at the top.