Your talking about PPI (Pixels per Inch) and your computer is altering it all the time, when you zoom into an image, when you re-size an image, when you change screen resolution. PPI works by altering the size of the pixels. 300 pixels are equal to one inch.
DPI (Dots per Inch) is the printer resolution and is often fixed at 300 dpi in commercial print houses. There's nothing 'magical' about that figure it's just a compromise between print quality, speed of printing and ink usage. Here are online PPI Calculator through which you can easily calculate all the pixels density conversions.