So what's an intern to do when in the presence of a celebrity they idolize, or perhaps even hate, at work?
The first thing you should do is take a deep breath and compose yourself. No crying. No screaming. No jumping up and down. No saying "Oh My God!" Save that for when you get home and call your friends (though this seems like a good time to point out that a lot of what you see at the office is completely confidential so you need to maintain good judgement as to what, if anything, is okay to talk about at all.) Right now you need to remember that even the biggest star is still a person: one who has fears, gets embarrassed, gets sick, has family, gets tired, etc. just like everyone else. Yes, they may be responsible for creating your favorite song, but they're still human. If you really don't think you can control yourself and don't want to end up as the intern who gets fired for spending 10 minutes stalking Justin Timberlake around the office crying and hyperventilating (true story), then excuse yourself to the bathroom or outside to get some air and calm down.
Remember They're There To Work
If a star is coming to the office, it's probably not just for the heck of it, there's probably some business concern that needs to be taken care of. Perhaps he or she is headed to the office discuss marketing the new record, argue over budgets, attend publicity training, refuse to extend a contract, or endure a lecture from an angry CEO. You don't know what kind of situation they are headed into or what is running through their head, but you can be almost certain that the meeting is about some aspect of their career and that they might feel angry, nervous, anxious, excited, stressed, or any other number of emotions. This is a place of business, so do what you can to keep it professional and if you have to interact then try your best to be welcoming, nice, and helpful.
And So Are You
Besides not freaking out, this is probably one of the most important things to remember if you run into a celebrity at work: that you are actually there to work. You may be tempted to walk through the waiting room countless times hoping that star will finally notice you, or head to the supply closet for a batch of CDs to have autographed, or even just sit at your desk in shock that the person you admire most is sitting 10 feet away, but don't. You are there to learn and to get work done and that is what you should be doing. So go back to what you were working on, look for something else to do, or ask your boss for more work (without interrupting). Just don't sit there looking fascinated or like you're trying to sneak a decent photo with your phone. That will probably just lead to trouble.