Sometimes people test positive for diseases they do not have, something that is known as a false positive test. False positives occur because no diagnostic test is perfect. As scientists design diagnostic tests that can find smaller and smaller evidence of a disease, they also open the door to accidentally detecting something that isn't really there. It's a tough balancing act.
Test quality is always a matter of balancing the need to try to catch as many cases as possible (sensitivity) with the need to not diagnose people who aren't actually sick (specificity.) Unfortunately, it's difficult to design tests that are good at both, so scientists try and figure out which outcome is worse in any given situation - a false positive or false negative and weigh things accordingly.
In general, if missing a diagnosis could cause long term harm, and the treatments for a condition aren't particularly dangerous or unpleasant, doctors would rather risk false positive tests. In such situations, it's better to over diagnose and over treat. However, if being diagnosed improperly could lead to serious harm - either physically through the use of dangerous treatments or emotionally because of the stigma associated with an infection - then it's better to under diagnose and try to catch the disease at a later stage when the condition is more clear.
Example: Doctors are very worried about false positive herpes tests. Because herpes is very common, and many people never have symptoms, they don't consider missing a diagnosis to be a very big deal. However, the disease is so stigmatized that a false positive test could be life-changing in a very negative way. Therefore, they are often reluctant to test for the virus in the absence of either symptoms or a known exposure, even though blood tests do exist.