No law that prohibits working when signed off sick, however it's a bad idea for lots of reasons.
If an employer allows you to work while off sick, their insurance will probably be invalid. They will be vulnerable to legal claims including particularly health and safety, and should there be any question of your condition either deteriorating or not improving as expected that could be put down to your working, obviously that could be a significant problem for them.
Talk to your doctor about the plan to sign you off sick, and discuss whether you would still need to be signed off if you were doing limited work from home. Depending on your condition, the type of operation and the instructions you get in terms of ensuring a quick recovery, the doctor may or may be prepared to recommend a phased return to work, starting with limited hours from home. If that's the case, you wouldn't be signed off sick.
However I would be very cautious about doing this. Depending on what your job is, if you are doing some work from home, really the only thing you are reducing is travelling. So you would need to be very clear that you are in fact fit enough to, for example, sit at a desk and use a computer, if that's what you do. If you're supposed to be resting, then that's probably not a good idea.
There will also be health and safety concerns, your desk and work station set up in the office is likely to be better and more easily adapted should you need that, so working at home may be counter-productive to your recovery.
You say that going into work will be more of a break because you won't be looking after your DS. Why would you need to look after him if you are off sick? Would you not be able to use whatever childcare you'd have if you were in work? I think you should talk to your doctor about that as well.
It sounds as though your boss is fairly well-meaning, but you and he need to pay attention to the medical advice you are given first and foremost. It's only a couple of weeks in the scheme of things, and not worth jeopardising your health and recovery time over.