Is it legal to do DIY work on gas?
In short, yes it is, but only if you are competent to do so.
So how is competence judged? You are to be your own judge of whether you are competent or not, but should some catastrophe result from your work, then it would seem clear that you were not competent and should not have tackled the work. That could leave you vulnerable to legal action (assuming you were still alive).
Regulation 3 (1) effectively says that anyone who works on gas must be competent. Regulation 3 (3) effectively says that anyone who is rewarded for gas work (in money or otherwise) must be registered with CORGI. The guidance notes published along with the laws state that level of competence must match the work being done.
I don’t think there has been a legal ruling yet on precisely what competence means in regard to DIY gas fitting, but for professionals it means they have the knowledge, experience and exam passes in the relevant aspects of gas fitting. There are dozens of exam categories covering domestic, commercial, liquefied petroleum gas (LPG), and more exotic gas fitting skills.
Opinions vary amongst DIYers as to the range of gas work they may undertake. The HSE and CORGI are unsurprisingly keen to stress that gas work should be done by competent people. It is my belief that the law is really aimed at eradicating the unregistered professionals whose motivation is their pocket and for whom public safety and customer satisfaction are at best secondary. Incompetent DIY gas fitting is inevitably unstoppable (for instance, I once saw a photo of a home made boiler). The HSE state that the majority of fatal gas incidents occur to the old, the poor, students, and those in rented housing. The regulations specifically try to address this situation.