It's not illegal to bury your pet.
When your pet dies you don't have to do anything special like you have to do when a human dies.
When your pet dies you can simply dig a hole in your garden, yard, backyard etc and bury the pet.
You don't have to put the pet in a bag, box etc if you don't want too although it's a good idea to do so.
You could also place the dead pet into a trash can if you have too.
Another option is pet cremation but that costs some money.
Whenever my dogs, cats etc have died I always just dug a hole in my backyard and buried the dog and cats in the backyard.
I buried the pets at least 4 feet deep and placed a rock over their body and on top of the grave to prevent other animals from digging them up.
Just make sure there's no utilities in the ground where you plan to dig and you'll be fine burying the pet in your yard.