Øresundståg departing from København H (Central Station) terminate at Kastrup Airport (last station in Denmark before the border) on track 2. There you have to exit the train, take the stairs or escalator up to the departure hall and go down to track 1, where you have to go through a passport or id control before being allowed to board the next train to Sweden. Note that this is not the proper immigration control, but a check performed by the train operator to make sure that they only allow passengers to board the train, who are eligible to enter Sweden. It is the same kind of 'pre-clearance' performed by airlines, where they verify that you are allowed to enter the destination country before they allow you to board. The real immigration control is then performed by the Swedish border police at Hyllie station, the first stop in Sweden, where the Øresundståg now has a scheduled stop for 10 minutes. Following the trip planner from Øresundståg or SJ, they offer you connections from Copenhagen to Malmö with a 29 minutes transfer in Kastrup. If the news reports are reliable, at least during rush hour, the waiting time at the checkpoint is said to often exceed an hour or more.
Long distance trains from København H towards Sweden all depart from track 26, where there is also a passport/id control before you are allowed to board the train. The trains have no scheduled stop before Malmö, but if I understand it correctly, the Swedish border police enters the train in Hyllie and conducts immigration controls during the ride to Malmö. The travel time has increased by about 20 minutes due to the immigration controls, but this is considered in the schedule. For the passport control before boarding, SJ recommends that you are at København H at least 30 minutes before departure.
To prevent the double check, first from a private security company before boarding the train and then once again by the Swedish border police after the actual border crossing, there have been negotiations between the Swedish and Danish authorities in an attempt to establish a legal possibility for the Swedish border police to conduct their immigration control on Danish soil before boarding, but until now without any success.
So to answer your questions:
We already had the subject a few days ago that HAFAS not always consider the correct transfer times: Where can I find resources on minimum transfer times for Swedish stations? If you only want to make sure that your onward ticket is still valid, you shouldn't have to worry about the time spent at the passport control if you buy a through ticket from Øresundståg or SJ. The ticket will be valid for the next train if you are delayed. If your concern is that you are connecting to a long distance train with an infrequent schedule, you might want to consider an even earlier departure with the Øresundståg to prevent long delays waiting for the next connecting train.
If you buy your ticket online on oresundstag.se, the ticket is bound to a specific train. If you buy two separate tickets to enforce a shorter transfer time in Kastrup, the onward ticket will not be valid on the following trains. If you buy a through ticket and are delayed for a longer time than what is expected by the booking system, your ticket will be valid for the next train. To answer the followup question from your comment: If you buy your Øresundståg ticket on sj.se, the ticket is also only valid for a specific train. I am not sure about the conditions for tickets sold by the German railways.
Yes, if you have a through ticket and you miss a connection due to delays not caused by yourself, you will be allowed to use the next train.