How can I melt cheese for dipping?
Normal cheese melts like that. It is made of proteins, fats, and water, and these separate when they are heated. 

For dipping, you need processed cheese. It has additives which keep the fat, fluid and solids mixed in a smooth mass. Also, it really helps to use very slow and even heat. This is the easy option. 

If you want to do it "for real", without processed cheese, you have to make a cheese fondue. It is traditionally made with Swiss cheese (I am fond of Appenzeller fondue), but you can use most types of semi-hard yellow cheese. It also contains some fluid, traditionaly white wine, and is emulsified with simple starch. It is preferable to have a special pan for this, as you can serve it heated. But if you make a big portion in a pan with a high thermal capacity, and make it immediately before serving, you can do without the special gear.