Cottoning on to something, in the sense of understanding it is a rather odd phrase. Indeed, it's so odd that it doesn't exist in America, so far as I can tell. On those strange shores cottoning on means getting on well with, which is in fact exactly what the phrase meant on these strange shores a hundred and fifty years ago.
In John Camden Hotten's A Dictionary of Slang, Cant and Vulgar Words Used at the Present Day in the Streets of London (1860), you'll find this entry; and it's pretty easy to see how you can go from liking something to understanding it.
COTTON, to like, adhere to, or agree with any person; "to COTTON on to a man," to attach yourself to him, or fancy him, literally, to stick to him as cotton would. Vide Bartlett, who claims it as an Amercanism; and Halliwell, who terms it an Archaism; also Bacchus and Venus 1737.
Well, Halliwell was right. The phrase is, to all intents and porpoises, pre-American and has been around since the mid sixteenth century. So far as anybody can tell it comes from the practise of lining clothes with cotton. So something that is made of a coarse, thick, warm material on the outside can have a cotton interior to make it comfortable. A dictionary of 1706 has this:
In making Hats, To Cotton well, is when the Wool and other Materials work well and imbody together.
Obviously, the inner and outer layer have to fit perfectly together and thus cotton well, and thus two people who fit together perfectly are said to have cottoned.
Or there's the possibility that it comes from the Welsh cytuno, meaning agree. I'd try to combine the two explanations, but they just won't cotton.