Lots of times, I will create icons like this on the fly, while designing interfaces in Photoshop. However, it's generally a good idea to keep these as separate assets in the event you want to do anything else with them.
Creating icons in Illustrator gives you more flexibility for your final output. You can paste them as shape layers into Photoshop, Sketch, etc. or use them directly in Illustrator for wireframing, interface design, or even print.
In the video below, you can see each step for creating a settings icon in Adobe Illustrator CC.
Side note: This is the first test video produced with my new audio equipment. I'm pretty pleased with the setup and quality so far, although I need to give the audio a bump up next time.
Edit > Transform > Transform Again
As a general rule, I try to create most icons by joining together basic shapes like circles, rectangles, etc. There are limits to this technique, but it serves as a great place to get started.
Continue ramping up your knowledge of Illustrator and learn tips and tricks to get super fast from both a thinking and design perspective in my new AIUX series.