Y-DNA is one of 26 chromosomes that determine what sort of biological being we are.
Like all chromosomes the Y ones are passed on from generation to generation and
occasionally change very slightly, particularly in their arrangement and not
necessarily in their properties.
Y-DNA has a property unique to this chromosome. It is not carried by females, so does not permit the option to prefer either the male's or the female's properties at conception. Whatever the Y-DNA does for the male frame is passed on more or less unchanged from generation to generation, but only to the males.
We can now identify a lot of the properties and features of the genes that we carry. We can identify that two males have the same Y-DNA and, much more commonly, that they have different Y-DNA. Somehow we can identify which Y-DNA a precded those with new or different characteristics in some minor regard. This means that we can trace the history of the changes and further, if we can obtain samples of long-dead people, show how they migrated from Afica and around the world.
The Y-chromosome idenifies who was the father of any given male. As the knowledge of the identifying features builds up we can say more clearly than ever who fathered whom.
Y-DNA is tracked by SNPs, Single Nucleotide Polymorphisms, which are some feature of the arrangement of the Y-DNA itelf. If two people share the same SNP they have a common ancestry. It can even be estimated how long ago the common ancestor lived, though this is not currently a precise science and is accompanied by 'plus or minus a few hundred years'. The corrollorary is if the y-dna of two males is very dissimilar then they are not related at all.