mtDNA (mitochondrial) is the female line DNA that is passed from a mother to her children. Everyone, male or female, carries mtDNA and can be tested but males don't pass it along to their children. Only females pass it along. mtDNA can connect people on your mother's mother's mother's (etc) line and can show the distant ancestry of your strictly female ancestral line.
yDNA is carried only by males and only males can be tested. This traces your father's father's father's (etc) line and can help connect males of the same surname. For example if I was able to find another man with the last name of Miller that is a yDNA match to me, I'd know that we descend from the same man on our Miller line somewhere along the line.