I have been issued a D visa to travel to Sweden(malmo) for studies.but am to travel through Copenhagen.hope it will not be a problem.
There is no problem. Your D visa is for Sweden, because that's where you're studying, but it is well understood that you may transit through other countries on your way there.
You'll pass through immigration when you arrive in Copenhagen, but your Swedish D visa is fine for this purpose. If you're asked about your plans, just answer honestly that you're going to Malmö for your studies. Indeed, your D visa allows you to stay in other Schengen countries as long as you do not exceed the 90/180 day rule, so you can use it to visit Copenhagen and not just pass through.