Regular Coke contains a significant amount of sugar, which makes it denser than water, so it sinks. Diet Coke, which is sugarless, is less dense than water, so it floats.
Although the cans of Diet and regular Coke are the same size, the large amount of sweetener in regular Coke means that there is more matter in the sugared variety. That difference shows up when the two are placed into water. Compared to the many grams of sugar that are part of the recipe for regular Coke, very little sweetener is needed for Diet Coke. The sugar-free version uses a relatively small amount of aspartame.