On most cars you can “short” certain pins on the diagnostics lead (connector) to get the computer to flash out a code corresponding to the problem. Often, the “check engine” light will flash a certain sequence (like Morse code) which you can then cross reference in the shop manual for your car to determine what the problem is. Most good shop manuals will tell you this procedure.
Note: this technique usually only gives you a general and/or vague idea of where the problem lies, but it at least will prevent an unsavory mechanic from replacing/charging you for work that isn’t needed if you know the approximate cause.
More sophisticated diagnostic pinpointing will require the use of a shop computer.
BTW, a good shop manual is the single best investment you can make in any vehicle you own, in my opinion. Forget whatever $60 doo-dad you planned on buying and get a good shop manual first.