why girls attain puberty earlier than boys
There is no straightforward answer to this - the age of puberty varies quite a lot in both boys and girls, anyway. It is probably to do with evolution. In primitive humans, it was best if females had as many children as possible, so it was an advantage if their bnody could have babies as soon as they were sufficiently grown to be able to carry them. Boys would have to compete for mates and it would be pointless trying to do this until they were well enough developed to have a chance of success.