Which Adobe software are you using?
Adobe Illustrator 2021
Was the menu: View --> Trim View active in these cases?
What do you mean? How can it be involved in this bug problem?
Maybe I misunderstood your question:
… while doing college assignments the current layers, for some unclear reason, became invisible. I tried to try to solve it or make it visible again … What I was doing is that I had cross a part of the picture over the whiteboard square and this mysterious bug happened …By @Beverly5E9A
If so, then describe a bit more in detail with screenshots before and after.