Being ‘stuck’ means something is “attached” or “can’t move”. A mouse that gets caught in a glue trap is a great example of this- because of the glue it is now attached to the trap and can’t move.
We can use it for either meaning:
attached: “The women stuck a flyer on the community billboard”
can’t move: “The fat thief tried to escape through the small window and got stuck”
We also use it for times when you aren’t literally “unable to move” but it feels that way.
“Sorry I’m late I got stuck in a meeting.”
= I was in a meeting I didn’t want to be in, and I couldn’t escape.
“I got stuck in traffic.”
“She is stuck in a bad marriage.”
It has the impression of helplessness that you’re in a situation that you cannot overcome with your own power.
This is why we use it for problems as well.
“I got stuck on a problem in my homework, it made me so frustrated I had to take a break.”
“I’m stuck on the last level in this game, I can’t figure out how to kill the final boss.”