At least two possibilities
The first is that the Death Star trash compactor had been used so rarely or that the station had been serviced so little that an ecosystem had begun to develop inside the trash compactor and who knows where else in the Death Star and a large tentacle beast had grown in this would be womb deep inside the most destructive weapon in the galaxy
The second is they just threw a tentacle monster in the trash
“I was looking at the trash compactor level, and I had an idea- nah, it’s dumb, never mind.”
“Hey, you know the policy here- there’s no such thing as a bad idea.”
“Okay, well, you know how they have compost piles where bugs and worms and stuff eat the compost, so what if we just sorta…. scaled that up for the trash compactor?”
“Bill… You’re a genius.”