Babies take off their own diapers because they don't like the diaper or they have a rash or they just find it fun that they can take off the diaper and love seeing your reaction.
Toddlers sometimes hate wearing diapers and will take the diapers off.
In those cases you sometimes need to put some duct tape, packing tape, masking tape etc around the diaper waistband to keep the diaper on.
Or put hard to get off pajamas on your baby or toddler to prevent access to the diaper.
In some cases for toddlers taking off a diaper may be a sign of potty training readiness although that is not always the case.
Usually it's a case of the baby just going through a phase and having fun pulling off the diaper and eventually it will stop.
Imagine yourself being in a diaper and wetting it and pooping it and you too would likely want that off as well.
For most kids and babies wearing a diaper is not comfortable or fun for them.
Also some babies and toddlers just love being naked as well.