The idea is that before the name of the father is inscribed when a child is born, it would be verified if he's actually the father. This would get rid of paternity fraud and would potentially save many men from raising a child that is not his and spending resources on it. It would also prevent accidental (or on purpose) baby switch, although this seems to be very rare.

Some countries make it difficult to get paternity tests to "preserve the peace", which benefits the child (fine) and the cheating mother (why?), but has the father as the loser. The worst offender is probably France, although there's not so much information available by country in the Wikipedia.

As far I know, in many USA states, even if it's proven that the father is actually not the biological father, he's still tied, legally, to the child so he has the responsibility to take care over him (like with child support), while in other countries, proving that you're not the father can absolve you from any responsibilities if presented in court and verified.

This is what Wikipedia says about it :

The legal implications of a paternity result test vary by state and according to whether the putative parents are unmarried or married. If a paternity test does not meet forensic standards for the state in question, a court-ordered forensic test may be required for the results of the test to have legal meaning. For unmarried parents, if a parent is currently receiving child support or custody, but DNA proves that the man is not the father later on, the support automatically stops; however, in many states, this testing must be performed during a narrow time window if a voluntary acknowledgment of parentage form has already been signed by the putative father; otherwise, the results of the test may be disregarded by law, and in many cases, a man may be required to pay child support, even though the child is biologically unrelated. In a few states, if the mother is receiving the support, then that alleged father has the right to file a lawsuit to get back any money that he lost from paying support. As of 2011, and in most states, unwed parents confronted with a voluntary acknowledgement of parentage form are informed of the possibility and right to request a DNA paternity test. If testing is refused by the mother, the father may not be required to sign the birth certificate or the voluntary acknowledgement of parentage form for the child. For wedded putative parents, the husband of the mother is presumed to be the father of the child. However, in most states, this presumption can be overturned by the application of a forensic paternity test, but in many states, the time for overturning this presumption may be limited to the first few years of the child's life, depending on the law of the state in question.

DNA tests seem to be highly accurate (99,99%).