The program you need was written like 60 years ago and it's free.
grep -Ff B.txt A.txt > C.txt
EDIT: This is better:
grep -wFf B.txt A.txt > C.txt
(And to make it case insensitive, use -iwFf)
grep -Ff B.txt A.txt > C.txt
EDIT: This is better:
grep -wFf B.txt A.txt > C.txt
(And to make it case insensitive, use -iwFf)