I’m curious. If you don’t know what PhDs do, why would having one appeal to you?
A PhD is a research degree, and generally speaking, PhD holders do research. The process of getting a PhD itself is a hybrid of a job and an academic program. You spend years of your life - usually at least 4; usually not much more than 10; generally between 5 and 7 - asking and answering research questions and solving hard and unsolved problems within your field.
In order to do that, you must first learn as much about your field as you possibly can very quickly. That’s what undergrad and the first few years of the doctoral degree are about - building a strong foundation. As you build that foundation, if you’re well suited for doctoral work, you’ll start to wonder about the connections between concepts and recognize the gaps that exist in the research you’re reading and learning about. A researcher aims to fill those gaps and develop new knowledge.
At it’s purest form in academia, it’s a career dedicated to asking and answering your own questions, which can be pretty sweet. Many people go into PhD programs with the aim of becoming academics, who are researchers and teachers who work at universities and colleges. They spend some mix of their time doing research in their field, teaching classes to undergraduates, and doing administrative work and service to keep their university and field going. What mix they do depends on the institution - at some places, like the Harvards and Michigans of the world, they may be doing mostly or entirely research and very little teaching. At other places, like community colleges and small regional teaching colleges, they may be doing entirely teaching and very little research. Most places have some mix/balance of both. Academic positions are VERY competitive (although math and CS are probably less so than most fields).
But people with PhDs can do a wide range of things that don’t include academia, particularly in math or CS. Some go on to work for technology companies doing research & development to create and refine brand new products and technologies. These jobs can pay a LOT of money - think starting in the six-figure range ($115-150K depending on the company), with high potential for growth over time. Some of those roles are almost pseudo-academic, where you choose what you study and compete for money and publish academic papers; others are much more applied and integrated with a product development team. (I have a job similar to this, although my PhD is in the social sciences.)
Some can work for financial services companies doing quantitative analysis (“quants”). These people also make a ton of money - more than the R&D technologists I mentioned above; I think their base pay tends to be in the $125-175K range to start out with at the bigger firms in expensive cities.
CS PhDs can also go into software development just like a CS BS or MS holder would; however, there’s not a huge pay bump over going in with an MS. The salaries are still pretty good, especially at some of the larger companies.
However, the giant prestigious awards like the Turing Award and Fields Medal tends to go to academics. That’s because academics are usually doing research for research’s sake - to find interesting things, push forward the field as a whole, and stretch the boundaries of our knowledge. Companies have bottom lines to meet, and industry researchers are usually doing research to improve a company’s product offerings. We’re also less likely to publish.
However, that’s not always true! Some of the large software companies have the budget and prestige to attract top researchers and give them the space to make big discoveries. Geoffrey Hinton is a 2018 Turing Award winner who splits his time working for Google and the University of Toronto; Yann LeCun, who also won the Turing Award last year, is a professor at NYU and the Chief AI Scientist at Facebook. Other Turing Award winners who were at least part-time in industry are David Patterson (Google, although he worked at UC Berkeley for 35 years) and John L. Hennessy (the Chair of Alphabet).