I think Cherry has already gave a very good answer. Simple, but very effective. I'd like to talk a little deeper. Essentially it's about 会and 到.
今天我学会了四十个生词
As a verb, 会alone in Chinese generally means 'be capable of, be able to, can...' so, if you say学会, it means you have learned and mastered those forty words You're capable of using them properly now.
今天我学到了四十个生词
As a verb, 到alone in Chinese generally means 'arrive', so when you say 学到, it's about things that are coming to you, but you may not receive or accept them. A teacher teaches you forty new words, so you 学到 forty words. Forty words have arrived at your lovely manor, whether you'll welcome, or get to know them, or first receive them but then drive them out, is totally another thing. LOL
Examples with both 学到 and 学会 in one sentence:
今天我学到了四十个生词,并且我都学会了。
今天我学到了四十个生词,但是有一些我没学会。
There are many Chinese synonyms go as the structure: AB, AC. At this time, it is the B and C that make the two synonymous words slightly different. Dig B and C a little deeper as to their most fundamental meanings, then the answer will come out.