Once on the 5th floor (if you chose to go there right away), go left and down all the way until you see a warp square. Step on it, and it'll take you to the 9th floor. Step back on it, and you'll return to where you were. Proceed by going to the right, where you'll find an Itemball containing the Card Key, which is used to open any locked door in the Silph. Co. Now that you've gotten this important item, you can explore the Silph Co. by battling Team Rocket and picking up a couple of items, including TMs. There's even a Move Tutor who'll teach your Pokemon Thunder Wave on the 2nd floor. Open all the locked doors just for fun, and because you simply can, and try every warp square. If you ever need to heal your Pokemon, you can do so on the 8th floor by sleeping on the bed.
When you're done exploring, head to the 3rd floor, and open the door on the left with your Card Key. Take the warp square in the first room, and you'll be teleported to a room on the 7th floor. Here, Gary will challenge you to a battle. As usual, Gary's team has gotten stronger, and hopefully, your Pokemon can take care of him. After defeating him, talk to the Silph Co. employee in the same room and he'll give you the Pokemon Lapras. Use the other warp square to get the the 11th floor. Go into the enclosed area, and Giovanni will challenge you to a match.
Giovanni has the following Pokemon: a lv. 37 Nidorino, a lv. 37 Rhyhorn, a lv. 35 Kangaskhan, and a lv. 41 Nidoqueen. After defeating him, Team Rocket will leave the building and the city. Go to the old man sitting on the sofa, and talk to him. He's the president of Silph Co., and he'll give you the Master Ball. There is only one Master Ball in the whole game, and it catches Pokemon 100% of the time. Now that this problem is taken care of, get out of Silph Co. and head north to the Fighting Dojo.
courtesy of pokedream.com